-
Notifications
You must be signed in to change notification settings - Fork 0
/
Animating_LGA_flight_history.R
68 lines (52 loc) · 2.43 KB
/
Animating_LGA_flight_history.R
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
59
60
61
62
63
64
65
66
67
68
###########################################################################################-
###########################################################################################-
##
## Animating LGA flight history ----
##
###########################################################################################-
###########################################################################################-
#=========================================================================================#
# Setting up ----
#=========================================================================================#
#-----------------------------------------------------------------------------------------#
# Loading libraries ----
#-----------------------------------------------------------------------------------------#
library(tidyverse)
library(lubridate)
library(glue)
#-----------------------------------------------------------------------------------------#
# Which date are we mapping?
#-----------------------------------------------------------------------------------------#
date_to_map <- "2020-04-06" %>% as_date()
#=========================================================================================#
# Animating ----
#=========================================================================================#
# Using ffmpeg, because with `filter_complex` I can specify the two frames folders as inputs,
# stack them on top of each other, and then animate those stacked frames
system(
glue(
'ffmpeg -hide_banner -y',
'-framerate 30',
'-start_number 1',
'-i "plots/map_frames/{date_to_map}/30_sec/map_frame_%d.png"',
'-framerate 30',
'-start_number 1',
'-i "plots/graph_frames/{date_to_map}/30_sec/graph_frame_%d.png"',
# simple way:
'-filter_complex vstack=inputs=2',
# complicated way:
# '-filter_complex [0][1]vstack[out] -map [out]',
'-c:v libx265',
'-x265-params range=full:qp=20',
'-pix_fmt yuvj420p',
'plots/LGA_Arrivals_30_sec_{date_to_map}.mp4',
.sep = " "
)
)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# #
# # ---- THIS IS THE END! ----
# #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #