-
Notifications
You must be signed in to change notification settings - Fork 0
/
video.sh
executable file
·43 lines (30 loc) · 1.11 KB
/
video.sh
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
#!/bin/bash
mv one_system*dat old/
rm *.dat
#make optimize || exit 1
./boids4 || exit $?
rm pictures/[0-9]*.png &> /dev/null || echo "nada removido"
moviename=$(ls one_system*dat).avi
gpParameters="notitle w p ps 3 pt 7"
range=$(./boids4 -p | grep "RANGE " | awk '{print $3*0.5}')
steps=$(( $(./boids4 -p | grep "STEPS " | awk '{print $3}') / $(./boids4 -p | grep "EXIT_INTERVAL " | awk '{print $3}') ))
echo -e "\nsteps: $steps"
for (( i=0; i<$steps ; i++ ))
do
array[$i]=$i
#grep -P "^${array[$i]}\t" one_system*dat > ${array[$i]}.dat
((echo -e "set terminal png size 1200,1200;
set xrange[-$range:$range];
set yrange[-$range:$range];
set output 'pictures/${array[$i]}.png';
plot './${array[$i]}_0.dat' u 3:4 $gpParameters lc rgb 'red',\
'./${array[$i]}_1.dat' u 3:4 $gpParameters lc rgb 'blue' ") | gnuplot)
if [ $((i%100)) == 0 ]; then
echo -ne "${array[$i]} " &
fi
done
echo -e "\n\n"
cd pictures
FFMpegParameters="-r 10 -i %d.png -vcodec libx264"
avconv $FFMpegParameters ../$moviename ||
ffmpeg $FFMpegParameters ../$moviename