ari_narrate creates a video from a script written in markdown and HTML slides created with rmarkdown or a similar package. This function uses Amazon Polly via ari_spin.

ari_narrate(
  script,
  slides,
  output = tempfile(fileext = ".mp4"),
  voice = text2speech::tts_default_voice(service = service),
  service = "amazon",
  capture_method = c("vectorized", "iterative"),
  subtitles = FALSE,
  ...,
  verbose = FALSE,
  audio_codec = get_audio_codec(),
  video_codec = get_video_codec(),
  cleanup = TRUE
)

Arguments

script

Either a markdown file where every paragraph will be read over a corresponding slide, or an .Rmd file where each HTML comment will be used for narration.

slides

A path or URL for an HTML slideshow created with rmarkdown, xaringan, or a similar package.

output

The path to the video file which will be created.

voice

The voice you want to use. See tts_voices for more information about what voices are available.

service

speech synthesis service to use, passed to tts. Either "amazon" or "google".

capture_method

Either "vectorized" or "iterative". The vectorized mode is faster though it can cause screens to repeat. If making a video from an ioslides_presentation you should use "iterative".

subtitles

Should a .srt file be created with subtitles? The default value is FALSE. If TRUE then a file with the same name as the output argument will be created, but with the file extension .srt.

...

Arguments that will be passed to webshot.

verbose

print diagnostic messages. If > 1, then more are printed

audio_codec

The audio encoder for the splicing. If this fails, try copy.

video_codec

The video encoder for the splicing. If this fails, see ffmpeg -codecs

cleanup

If TRUE, interim files are deleted

Value

The output from ari_spin

Examples

if (FALSE) { # ari_narrate(system.file("test", "ari_intro_script.md", package = "ari"), system.file("test", "ari_intro.html", package = "ari"), voice = "Joey") }