Search code examples
markdownknitrrstudiochunks

Mp4 file not generated in R markdown


I set chunk option: fig.show='animate' in R markdown. But there is no mp4 file generated in the Figure Folder. Also no animation displayed in the knitted html. Any help or suggestion? Thanks!


Solution

  • I am using MAC mountain lion. It works well:

    Firstly you will need an MP3 encoder. FFmpeg doesn't include one, but it will use LAME, which can be downloaded here.

    In terminal, make a new directory and unzip the downloaded LAME. I am using the currently latest version lame-3.99.5.

    mkdir ~/lame
    cd ~/lame
    tar xvzf lame-3.99.5.tar.gz
    

    After downloading and unpacking the source or checking it out from CVS, change to the main directory and then enter the three commands which are typically used to build open source projects:

    cd lame-3.99.5
    ./configure
    make
    sudo make install
    

    Then create a working directory:

    mkdir ~/ffmpeg
    cd ~/ffmpeg
    

    The up-to-date version of FFmpeg generally compiles cleanly, and that is the version you usually will want:

    svn checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg
    cd ffmpeg
    

    Next, configure and make

    ./configure --enable-libmp3lame --enable-shared --disable-mmx --arch=x86_64
    make
    sudo make install
    

    Done!