Convert movie frames to .gif shell script
10Oct11
#/bin/sh
#Make a Gif from 3 frames from a movie
#Usage gifmaker.sh /path/to/movie.bla n n /outputfile.bla
#ARGS $1=INPUT FILENAME $2=NUM FRAMES $3=START POS $4=OUTPUT FILENAME
#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)
do
convert $1-$FRAME.png $1-$FRAME.gif
done
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.
Filed under: Scripts | Leave a Comment
Tags: gif, linux, sh, terminal








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