-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_animation.sh
More file actions
53 lines (43 loc) · 1.46 KB
/
build_animation.sh
File metadata and controls
53 lines (43 loc) · 1.46 KB
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
#!/bin/bash
# file: build_animation.sh, author: John Sauter, date: September 10, 2025.
# Construct an animation from an event log.
renderer=${1}
processor="${2}"
source="${3}"
last_event_time_file=${4}
animation_temp="${5}"
intersection_file="${6}"
background_image="${7}"
frame_rate="${8}"
last_event_time=$(<${last_event_time_file})
echo "last event time " ${last_event_time}
# Start time is in seconds.
start_time="200"
# Batch size and count are in numbers of frames.
# Each batch processes 100 frames.
batch_size="100"
# Compute the number of batches from the duration of the animation.
# Duration in seconds.
let "temp = ${last_event_time} - ${start_time}"
# Duration in frames
let "temp = ${temp} * ${frame_rate}"
#Number of batches, rounded down
let "temp = ${temp} / ${batch_size}"
# Round up.
let "batch_count = ${temp} + 1"
echo "batch count " ${batch_count}
rm -rf ${animation_temp}/
mkdir ${animation_temp}
for (( counter=0; counter<=${batch_count}; counter+=1 )); do
let "temp = ${counter} * ${batch_size}"
let "start_frame = ${temp}"
let "temp= ${counter} + 1"
let "temp= ${temp} * ${batch_size}"
let "end_frame= ${temp} - 1"
parallel --semaphore --ungroup --halt now,fail=1 --jobs 20 --quote \
bash "${renderer}" "${processor}" "${source}" \
"${animation_temp}" ${start_time} ${start_frame} ${end_frame} \
${frame_rate} ${background_image} ${intersection_file} ";"
done
parallel --semaphore --wait
# End of file build_animation.sh