4

I am trying to animate a sequence of plots in R Markdown but the video doesn't show up. Taking the advice from here I downloaded ffmpeg, but this still didn't get it to work.

I am using R version 3.2.0 and RStudio on OS X El Capitan. Here is my code:

---
title: "Animate"
author: "Thomas Bayes"
date: "February 2, 2016"
output: html_document
---


```{r animate, echo=FALSE,  fig.show = 'animate'}
x <- seq(from = 0, to = 10, by = .5)
for(k in 1:5){
    plot(x,sin(k*x), type = 'l')
}
```

And the output is just an empty video screen. Nothing happens when I click play. output

Cœur
  • 37,241
  • 25
  • 195
  • 267

1 Answers1

0

Your browser is either unable to run the MIME-encoded data in the HTML-file or is missing the right codec for the video. The animation data is typically stored in an html-tag like this:

<source src="data:video/webm;base64,GkXfowEAA... ...HxggFv8IED">

From the tag you can see that the MIME format is video/webm. As a first test you can take your HTML-file and open it in another browser. This way you know that the Markdown/Animate side of it is working (The Markdown output will already give a clue).

Tha you can test the video/webm support of your browser on the following websites:

https://html5test.com/

https://www.youtube.com/html5

https://www.webmfiles.org/demo-files/

If these videos run in your browser, than it is likely some browser or codec problem. In case of codec problems it might help to install ffmpeg or the VLC media player since they come with many codecs. For my Firefox browser, people suggest clearing the browser cache but that did not work either.

So in the end I installed Google Chrome and that was working out of the box.

sdittmar
  • 365
  • 2
  • 14