Skip to content

Commit

Permalink
Make subsampled animation
Browse files Browse the repository at this point in the history
  • Loading branch information
edwardlavender committed Jul 11, 2024
1 parent eff5e08 commit 7f7e8f8
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions R/003-figs.R
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ dev.off()
tic()
steps <- paths$timestep
routine <- "forward-filter"
# routine <- "smoother"
routine <- "smoother"
if (routine == "forward-filter") {
s <- pff_imperfect$states[timestep %in% steps, ]
}
Expand Down Expand Up @@ -465,13 +465,23 @@ pf_plot_xy(.map = map_ani,
pbapply::pboptions(pbo)
toc()

#### Make animation (~6 mins)
#### Make full animation (~6 mins)
tic()
input <- file_list(frames)
output <- file.path(dirname(frames), "ani.mp4")
av::av_encode_video(input, output, framerate = 1000)
toc()

#### Make subsampled animation (~40 s)
# A slower framerate with fewer frames is better in pptx
tic()
input <- file_list(frames)
input <- input[seq(1, length(input), by = 10)]
output <- file.path(dirname(frames), "ani-subsample-fs=25.mp4")
length(input)
av::av_encode_video(input, output, framerate = 25)
toc()


#### End of code.
#########################
Expand Down

0 comments on commit 7f7e8f8

Please sign in to comment.