Took 139 pictures/videos, generated a number of video clips and panning crop filters on static images and stitched them all together using the following Makefile.
Enjoy.
$ cat -n Makefile
1 FPS=30
2 JPGSECS=6
3 Images=${wildcard */*.jpg}
4 ScaledImageClips=${filter-out %-scaled-scaled.mp4, ${subst .jpg,.mp4,${subst .jpg,-scaled.jpg,${Images}}}}
5 Vids=${wildcard */*.mp4}
6 ScaledVidClips=${filter-out %-scaled-scaled.mp4, ${subst .mp4,-scaled.mp4,${Vids}}}
7
8 all: final.mp4
9
10 final.mp4: video.mp4 audio.mp3
11 # ${SH} ffmpeg -i video.mp4 -i audio.mp3 -acodec copy -shortest $@
12 ${SH} ffmpeg -y -i video.mp4 -i audio.mp3 -af 'afade=t=out:st=193:d=3' -strict -2 -shortest $@
13
14 video.mp4: clip01.mp4 clip01b.mp4 clip02.mp4 clip03.mp4 clip04.mp4 clip05.mp4 clip06.mp4 clip07.mp4 clip07a.mp4 clip08.mp4 clip09.mp4 clip10.mp4 clip11.mp4 clip11a.mp4 clip12.mp4 clip13.mp4 clip13a.mp4 clip13b.mp4 clip14.mp4 clip15.mp4 clip16.mp4 clip17.mp4 clip18.mp4 clip19.mp4 clip19b.mp4 clip20.mp4 clip21.mp4 clip21a.mp4 clip21b.mp4 clip21c.mp4 clip22.mp4 clip23.mp4 clip24.mp4 clip25.mp4 clip26.mp4
15 ${SH} rm concat.txt | true
16 ${SH} for f in $^; do echo "file '$$f'" >> concat.txt; done
17 ${SH} ffmpeg -y -f concat -i concat.txt -an $@
18
19 all2: ${ScaledImageClips} ${ScaledVidClips}
20
21 sortByTs:
22 ${SH} echo "#!/usr/bin/python" > $@
23 ${SH} echo 'import sys;' >> $@
24 ${SH} echo 'import re;' >> $@
25 ${SH} echo '' >> $@
26 ${SH} echo 'inFile=sys.argv[1];' >> $@
27 ${SH} echo '' >> $@
28 ${SH} echo 'with open(inFile, "r") as fp:' >> $@
29 ${SH} echo ' C=fp.read();' >> $@
30 ${SH} echo ' L=C.split("\\n");' >> $@
31 ${SH} echo '' >> $@
32 ${SH} echo 'D=dict();' >> $@
33 ${SH} echo 'for e in L:' >> $@
34 ${SH} echo ' m=re.match(r"\D+(\d+_\d+)(\D+)",e);' >> $@
35 ${SH} echo ' if m:' >> $@
36 ${SH} echo ' D[m.group(1)]=e;' >> $@
37 ${SH} echo '' >> $@
38 ${SH} echo 'for k in sorted(D.keys()):' >> $@
39 ${SH} echo ' print D[k];' >> $@
40 ${SH} echo '' >> $@
41 ${SH} chmod +x $@
42
43 storyboard.txt: files.list sortByTs
44 ${SH} ./sortByTs $< > $@
45
46 files.list:
47 ${SH} for f in $(shell echo ${ScaledImageClips} ${ScaledVidClips} ); do echo $$f >> $@ ; done
48
49 storyboard.mp4: ${ScaledImageClips} ${ScaledVidClips} storyboard.txt
50 ${SH} for f in `cat storyboard.txt`; do echo "file '$$f'" >> concat.txt; done
51 ${SH} ffmpeg -y -f concat -i concat.txt -strict -2 $@
52 ${SH} rm concat.txt
53
54 %-scaled.mp4: %.jpg
55 ${SH} mogrify -auto-orient $<
56 ${SH} ffmpeg -y -loop 1 -i $< -f lavfi -i aevalsrc=0 -shortest -filter_complex "scale=1920:-2:force_original_aspect_ratio=decrease,scale=-2:1080:force_original_aspect_ratio=decrease,pad=1920:1080:(ow-iw)/2:(oh-ih)/2,drawtext=fontcolor=white:fontsize=36:fontfile=/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf:text=$^" -r ${FPS} -vframes $(shell echo $(FPS)*$(JPGSECS) | bc) -strict -2 $@
57
58 %-scaled.mp4: %.mp4
59 ${SH} ffmpeg -y -i $< -filter_complex "scale=1920:-2,drawtext=fontcolor=white:fontsize=36:fontfile=/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf:text=$^,scale=-2:1080,pad=1920:1080:(ow-iw)/2:(oh-ih)/2" -r 30/1 -acodec copy $@
60
61 background.jpg:
62 ${SH} convert -size 1920x1080 xc:black $@
63
64 clip01.mp4: Motorola/IMG_20200515_091545370_HDR.jpg
65 ${SH} ffmpeg -y -loop 1 -i $< -vf "crop=1920:1080:1000:1300-(5*n)" -r ${FPS} -vframes $(shell echo $(FPS)*$(JPGSECS) | bc) -vcodec libx264 $@
66
67 clip01b.mp4: Samsung/20200515_101726.mp4
68 ${SH} ffmpeg -i $< -acodec copy -ss 2 -t 6 -vcodec libx264 $@
69
70 clip02.mp4: Motorola/IMG_20200515_100605080.jpg
71 ${SH} ffmpeg -y -loop 1 -i $< -vf "crop=1920:1080:1000+(2*n):1300-(6*n)" -r ${FPS} -vframes $(shell echo $(FPS)*$(JPGSECS) | bc) -vcodec libx264 $@
72
73 clip03.mp4: Samsung/20200515_101151.mp4
74 ${SH} ffmpeg -i $< -vf "crop=1920/2:1080/2:0:240,scale=1920:1080" -pix_fmt yuv420p -acodec copy -ss 21 -t 8 -vcodec libx264 $@
75
76 clip04.mp4: Samsung/20200515_101523.jpg
77 ${SH} ffmpeg -y -loop 1 -i $< -vf "crop=1920:1080:1920+(5*n):1280-(2*n)" -r ${FPS} -vframes $(shell echo $(FPS)*$(JPGSECS) | bc) -vcodec libx264 $@
78
79 clip05.mp4: Samsung/20200515_102050.mp4
80 ${SH} ffmpeg -i $< -vf "crop=1920:1080:0:0" -acodec copy -ss 11 -t 4 -vcodec libx264 $@
81
82 #--here
83 clip06.mp4: Samsung/20200515_102948.mp4
84 ${SH} ffmpeg -i $< -acodec copy -ss 5 -t 6 -vcodec libx264 $@
85
86 clip07.mp4: Motorola/VID_20200515_103223863.mp4
87 ${SH} ffmpeg -i $< -acodec copy -ss 18 -t 3 -vcodec libx264 $@
88
89 clip07a.mp4: Samsung/20200515_104151.mp4
90 ${SH} ffmpeg -i $< -acodec copy -ss 0 -t 6 -vcodec libx264 $@
91
92 clip08.mp4: Motorola/VID_20200515_104921374.mp4
93 ${SH} ffmpeg -i $< -vcodec copy -acodec copy -ss 18 -t 3 -vcodec libx264 $@
94
95 clip09.mp4: Motorola/VID_20200515_104921374.mp4
96 ${SH} ffmpeg -i $< -vcodec copy -acodec copy -ss 32 -t 6 -vcodec libx264 $@
97
98 clip10.mp4: Samsung/20200515_105549.mp4
99 ${SH} ffmpeg -i $< -vcodec copy -acodec copy -ss 25 -t 6 -vcodec libx264 $@
100
101 clip11.mp4: Motorola/VID_20200515_105953712.mp4
102 ${SH} ffmpeg -i $< -vcodec copy -acodec copy -ss 0 -t 6 -vcodec libx264 $@
103
104 clip11a.mp4: Motorola/VID_20200515_112402173.mp4
105 ${SH} ffmpeg -i $< -vcodec copy -acodec copy -ss 6 -t 6 -vcodec libx264 $@
106
107 clip12.mp4: Samsung/20200515_113100.mp4
108 ${SH} ffmpeg -i $< -vcodec copy -acodec copy -ss 19 -t 6 -vcodec libx264 $@
109
110 clip13.mp4: Motorola/VID_20200515_113612595.mp4
111 ${SH} ffmpeg -i $< -vcodec copy -acodec copy -ss 0 -t 6 -vcodec libx264 $@
112
113 clip13a.mp4: Motorola/VID_20200515_123906857.mp4
114 ${SH} ffmpeg -i $< -vcodec copy -acodec copy -ss 25 -t 6 -vcodec libx264 $@
115
116 clip13b.mp4: Motorola/IMG_20200515_124841138.jpg
117 ${SH} ffmpeg -y -loop 1 -i $< -vf "crop=1920:1080:1920/2+(5*n):1280-(2*n)" -r ${FPS} -vframes $(shell echo $(FPS)*$(JPGSECS) | bc) -vcodec libx264 $@
118
119 clip14.mp4: Motorola/VID_20200515_114433396.mp4
120 ${SH} ffmpeg -i $< -vcodec copy -acodec copy -ss 0 -t 10 -vcodec libx264 $@
121
122 clip15.mp4: Samsung/20200515_115303.mp4
123 ${SH} ffmpeg -i $< -vcodec copy -acodec copy -ss 86 -t 6 -vcodec libx264 $@
124
125 clip16.mp4: Motorola/VID_20200515_121029775.mp4
126 ${SH} ffmpeg -i $< -vcodec copy -acodec copy -ss 0 -t 4 -vcodec libx264 $@
127
128 clip17.mp4: Motorola/VID_20200515_121448017.mp4
129 ${SH} ffmpeg -i $< -vcodec copy -acodec copy -ss 0 -t 2 -r 30 -vcodec libx264 $@
130
131 clip18.mp4: Motorola/VID_20200515_122255180.mp4
132 ${SH} ffmpeg -i $< -vcodec copy -acodec copy -ss 14 -t 3 -vcodec libx264 $@
133
134 clip19.mp4: Motorola/VID_20200515_130750462.mp4
135 ${SH} ffmpeg -i $< -vcodec copy -acodec copy -ss 0 -t 6 -vcodec libx264 $@
136
137 clip19b.mp4: Motorola/IMG_20200515_131917817.jpg
138 ${SH} ffmpeg -y -loop 1 -i $< -vf "crop=1920:1080:1920/2+(5*n):960-(2*n)" -r ${FPS} -vframes $(shell echo $(FPS)*$(JPGSECS) | bc) -vcodec libx264 $@
139
140 clip20.mp4: Motorola/VID_20200515_132127514.mp4
141 ${SH} ffmpeg -i $< -vcodec copy -acodec copy -ss 2 -t 3 -r 30 -vcodec libx264 $@
142
143 clip21.mp4: Samsung/20200515_133613.mp4
144 ${SH} ffmpeg -i $< -vcodec copy -acodec copy -ss 9 -t 6 -vcodec libx264 $@
145
146 clip21a.mp4: Samsung/20200515_134350.mp4
147 ${SH} ffmpeg -i $< -vcodec copy -acodec copy -ss 9 -t 6 -vcodec libx264 $@
148
149 clip21b.mp4: Motorola/VID_20200515_140305984.mp4
150 ${SH} ffmpeg -i $< -vcodec copy -acodec copy -ss 0 -t 6 -vcodec libx264 $@
151
152 clip21c.mp4: Samsung/20200515_140926.mp4
153 ${SH} ffmpeg -i $< -vcodec copy -acodec copy -ss 3 -t 6 -vcodec libx264 $@
154
155 clip22.mp4: Motorola/IMG_20200515_144241756_HDR.jpg
156 ${SH} ffmpeg -y -loop 1 -i $< -vf "crop=1920:1080:1920/2+(5*n):1280-(2*n)" -r ${FPS} -vframes $(shell echo $(FPS)*$(JPGSECS) | bc) -vcodec libx264 $@
157
158 clip23.mp4: Samsung/20200515_145819.mp4
159 ${SH} ffmpeg -i $< -vcodec copy -acodec copy -ss 28 -t 6 -vcodec libx264 $@
160
161 clip24.mp4: Samsung/20200515_145925.mp4
162 ${SH} ffmpeg -i $< -vcodec copy -acodec copy -ss 7 -t 6 -vcodec libx264 $@
163
164 clip24a.mp4: Samsung/20200515_150020.mp4
165 ${SH} ffmpeg -i $< -vcodec copy -acodec copy -ss 3 -t 6 -vcodec libx264 $@
166
167 clip25.mp4: Samsung/20200515_150020.mp4
168 ${SH} ffmpeg -i $< -vcodec copy -acodec copy -ss 46 -t 6 -vcodec libx264 $@
169
170 clip26.mp4: Samsung/20200515_150837.mp4
171 ${SH} ffmpeg -i $< -vcodec copy -acodec copy -ss 32 -t 6 -vcodec libx264 $@
172
173 audio.mp3: audio.mp4
174 ${SH} ffmpeg -i $< -vn $@
175
176 audio.mp4:
177 # ${SH} youtube-dl https://www.youtube.com/watch?v=BLQaGEI5D2Q --format mp4 -o $@
178 ${SH} youtube-dl https://www.youtube.com/watch?v=qSZGt_vQMcs --format mp4 -o $@
179
180 clean:
181 ${RM} ${ScaledImageClips} ${ScaledVidClips}
182 ${SH} svn revert $(shell svn status | grep "^M" | grep -v Makefile | cut -b 2-) | true
183 ${RM} files.list files.txt
$