Convert movie frames to .gif shell script

#Make a Gif from 3 frames from a movie
#Usage /path/to/movie.bla n  n /outputfile.bla

#extract 3 .PNG files from source video
ffmpeg -i $1 -r 25 -vframes $2 -ss $3 $1-%03d.png

#convert .PNGs into single .GIFs
for FRAME in $(seq -f %03g $2)
   convert $1-$FRAME.png $1-$FRAME.gif

FWD=$(/bin/ls $1-*.gif)
BWD=$(echo "${FWD}" | sed 1d | sort -r | sed 1d)

#combine in gifsicle
gifsicle  --delay 4 --loopcount=0 --colors 256 $FWD $BWD > $4.gif

Networked Media – Piet Zwart Terminal Sessions

Sh script that enables you to output n number of frames as a gif from a timecoded position on a video file.

Images taken from comedy-horror classic Horror Express.

No Responses Yet to “Convert movie frames to .gif shell script”

  1. Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: