The goal of ari_paper is to showcase the ari
package. We show how to use
each function and the output videos. This README uses the
video
package to render videos
inside the markdown. The paper can be viewed at
https://johnmuschelli.com/ari_paper/.
library(tuneR)
library(ari)
result = ari_stitch(
ari_example(c("mab1.png", "mab2.png")),
list(noise(), noise()),
output = "noise.mp4")
isTRUE(result)
attributes(result)$outfile
Let us take a part of Mercutio’s speech from Shakespeare’s Romeo and Juliet [@shakespeare2003romeo] and overlay it on 2 images from the Wikipedia page about Mercutio (https://en.wikipedia.org/wiki/Mercutio):
res = ffmpeg_audio_codecs()
fdk_enabled = grepl("fdk", res[ res$codec == "aac", "codec_name"])
if (fdk_enabled) {
audio_codec = "libfdk_aac"
} else {
audio_codec = "aac"
}
speech = c(
"I will now perform part of Mercutio's speech from Shakespeare's Romeo and Juliet.",
"O, then, I see Queen Mab hath been with you.
She is the fairies' midwife, and she comes
In shape no bigger than an agate-stone
On the fore-finger of an alderman,
Drawn with a team of little atomies
Athwart men's noses as they lies asleep;")
mercutio_file = "death_of_mercutio.png"
mercutio_file2 = "mercutio_actor.png"
output = "romeo.mp4"
if (!file.exists(output)) {
run_voice = "Joanna"
ari_spin(
c(mercutio_file, mercutio_file2),
speech, output = output, voice = run_voice,
service = "amazon",
audio_codec = audio_codec)
}
We can also generate the video using the voice Brian
, which is an
British English male voice: