Skip to content

Commit 7f7e8f8

Browse files
Make subsampled animation
1 parent eff5e08 commit 7f7e8f8

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

R/003-figs.R

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ dev.off()
431431
tic()
432432
steps <- paths$timestep
433433
routine <- "forward-filter"
434-
# routine <- "smoother"
434+
routine <- "smoother"
435435
if (routine == "forward-filter") {
436436
s <- pff_imperfect$states[timestep %in% steps, ]
437437
}
@@ -465,13 +465,23 @@ pf_plot_xy(.map = map_ani,
465465
pbapply::pboptions(pbo)
466466
toc()
467467

468-
#### Make animation (~6 mins)
468+
#### Make full animation (~6 mins)
469469
tic()
470470
input <- file_list(frames)
471471
output <- file.path(dirname(frames), "ani.mp4")
472472
av::av_encode_video(input, output, framerate = 1000)
473473
toc()
474474

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

476486
#### End of code.
477487
#########################

0 commit comments

Comments
 (0)