User:Silviolorusso/Gifmaka

From XPUB & Lens-Based wiki
< User:Silviolorusso
Revision as of 17:48, 15 October 2011 by Silviolorusso (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

A little script to get frames from a video file and create an animated gif.

 
#!/bin/sh

# Extract three PNG frames from a movie | $1 movie name | $2 time position in seconds | $3 number of frames
ffmpeg -i $1 -r 25 -ss $2 -vframes $3 $1-%03d.png

# convert PGN to single GIF

for FRAME in $(seq -f %03g $3)
do
	convert $1-$FRAME.png $1-$FRAME.gif
	rm $1-$FRAME.png
done

# combine all individual GIF in an animated one
FWD=$(/bin/ls $1-*.gif)
BWD=$(echo "${FWD}" | sed 1d | sort -r | sed 1d)

gifsicle --delay 4 --loopcount=0 --colors 256 \
$FWD $BWD > $1-anim.gif 

# remove files
rm $FWD

Examples of use of GIFMAKA capturing frames from Vampire in Venice directed by Augusto Caminito.

Vampire1.gif
Vampire2.gif
Vampire3.gif
Vampire4.gif
Vampire5.gif
Vampire6.gif