My favorites | Sign in
Project Logo
                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash

if [ $# -lt 2 ] ; then
echo "creates a videostrip, result will be at videostrip.gif"
echo "assumes video is 320x240"
echo "usage: $0 foo1.avi foo2.avi ..."
exit 1
fi

# square size of each video
SIZE=100

TOTAL_TIME=`date +%s`
EFFECT[0]=""
EFFECT[1]="-colorspace Gray -fill yellow -tint 85"
EFFECT[2]="-colorspace Gray -fill green -tint 75"
EFFECT[3]="-colorspace Gray -fill red -tint 75"
EFFECT[4]="-colorspace Gray -fill blue -tint 75"
#EFFECT[5]="-threshold 40%"
#EFFECT[6]="-threshold 40% -negate"
#EFFECT[7]="-threshold 40% -fill yellow -opaque black"
#EFFECT[8]="-threshold 40% -fill green -opaque black"
#EFFECT[9]="-threshold 40% -fill red -opaque black"
#EFFECT[10]="-threshold 40% -fill blue -opaque black"

EFFECT=${EFFECT[$(($RANDOM%${#EFFECT[*]}))]}
echo "using effect $EFFECT...enjoy :)"
FILENUM=1
for i in $* ; do
TMPFILE_GIF="/tmp/$$_$FILENUM.gif"
TMPFILE_MOV="/tmp/$$_$FILENUM.mov"
FILENUM=$((FILENUM+1))
echo -n "processing $i..."
TIME=`date +%s`
# converts FLA -> MOV -> GIF, for better quality
ffmpeg -an -i $i -sameq -r 10 $TMPFILE_MOV 2> /dev/null
mplayer -really-quiet -vo gif89a:fps=15:output=$TMPFILE_GIF $TMPFILE_MOV -ao none
# applies an effect to the gif
convert $TMPFILE_GIF -shave 40x0 $EFFECT -resize ${SIZE}x${SIZE} $TMPFILE_GIF
echo "$((`date +%s`-$TIME))s"
done

# build the command to group all the images
LENGTH=$((($FILENUM-1)*${SIZE}))
CMD="convert /tmp/$$_1.gif -repage ${SIZE}x$LENGTH -coalesce"
for ((i=2;i<$FILENUM;i+=1)); do
CMD=${CMD}" null: ( /tmp/$$_$i.gif -coalesce ) -geometry +0+$((($i-1)*${SIZE})) -layers Composite"
done
CMD=${CMD}" videostrip.gif"
echo -n "building videostrip.gif..."
TIME=`date +%s`
# echo to see the entire command
$CMD
echo "$((`date +%s`-$TIME))s"


rm /tmp/$$_*
echo "done...$((`date +%s`-$TOTAL_TIME))s"
Show details Hide details

Change log

r2 by alexpolvi on Oct 23, 2008   Diff
woohoo, script and some examples
Go to: 
Project members, sign in to write a code review

Older revisions

All revisions of this file

File info

Size: 1823 bytes, 58 lines

File properties

svn:executable
*
Hosted by Google Code