Create videos from 'R Markdown' documents, or images and audio files. These images can come from image files or HTML slides, and the audio files can be provided by the user or computer voice narration can be created using 'Amazon Polly'. The purpose of this package is to allow users to create accessible, translatable, and reproducible lecture videos. See < https://aws.amazon.com/polly/> for more information.
Ari is an R package designed to help you make videos from plain text files. Ari uses Amazon Polly to convert your text into speech. You can then provide images or a set of HTML slides which Ari will narrate based on a script you provide. Ari uses FFmpeg to stitch together audio and images.
You can install ari from github with:
You also need to make sure you have FFmpeg version 3.2.4 or higher installed on your system.
First create an HTML slide presentation based in R Markdown using a package
xaringan. To see an example presentation
browseURL(ari_example("ari_intro.html")) into the R console. For every
slide in the package you should write some text that will be read while the
slide is being shown. You can do this in a separate Markdown file (see
file.show(ari_example("ari_intro_script.md"))) or you can use HTML comments
to put narration right in your
.Rmd file (see
file.show(ari_example("ari_comments.Rmd"))). Make sure to knit your
file into the HTML slides you want to be turned into a video.
Once you've finished your script and slides install the
aws.polly package. You can find a
guide for quickly setting up R to use Amazon Web Services
aws.polly::list_voices() to make sure your keys are working (this
function should return a data frame). Once you've set up your access keys you
can start using Ari.
These examples make use of the
ari_example() function. In order to view the
files mentioned here you should use
You can watch an example of a video produced by Ari
library(ari)# First set up your AWS keysSys.setenv("AWS_ACCESS_KEY_ID" = "EA6TDV7ASDE9TL2WI6RJ","AWS_SECRET_ACCESS_KEY" = "OSnwITbMzcAwvHfYDEmk10khb3g82j04Wj8Va4AA","AWS_DEFAULT_REGION" = "us-east-2")# Create a video from a Markdown file and slidesari_narrate(ari_example("ari_intro_script.md"),ari_example("ari_intro.html"),voice = "Joey")# Create a video from an R Markdown file with comments and slidesari_narrate(ari_example("ari_comments.Rmd"),ari_example("ari_intro.html"),voice = "Kendra")# Create a video from images and stringsari_spin(ari_example(c("mab1.png", "mab2.png")),c("This is a graph.", "This is another graph"),voice = "Joanna")# Create a video from images and Waveslibrary(tuneR)ari_stitch(ari_example(c("mab1.png", "mab2.png")),list(noise(), noise()))
Creating videos from plain text has some significant advantages:
At the Johns Hopkins Data Science Lab we rapidly develop highly technical content about the latest libraries and technologies available to data scientists. Video production requires a significant time investment and APIs are always changing. If the interface to a software library changes it's particularly arduous to re-record an entire lecture because some function arguments changed. By using Ari we hope to be able to rapidly create and update video content.
ari_stitch(): create a video from images and audio files.
ari_spin(): create a video from images and text.
ari_narrate(): create a video from an R Markdown file.