3

I make a presentation with LaTex using beamer.

I have succeeded in add movie in Sharelatex and my code is as follows :

\documentclass[]{beamer}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\usepackage{multimedia}

\begin{document}
\begin{frame}{}
    \begin{center}
        \movie[width=0.5\textwidth,showcontrols=true]
        {% placeholder = text or image
            \includegraphics[width=0.4\textwidth]{myPic.png}
        }%
        {myMovie.avi} % video filename
    \end{center}
\end{frame}
\end{document}

But I can't read my movie in Ubuntu. I read in some site it's because my PDF reader can't. I may understand it's possible but I doesn't find how.

ebosi
  • 11,692

2 Answers2

3

As you mentioned you are using Ubuntu, the question PDF viewer combined with video player on Askubuntu suggest to use Okular to read the video embedded in your PDF.

Indeed, all pdf-reader do not support movies-, screen- or rich media-annotations; evince is one of them.

Following MWE worked for me with .avi and .mp4 videos, when open with Okular: 0.19.3.

\documentclass[bookmarks=true]{beamer}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\usepackage{multimedia}

\begin{document}
    \begin{frame}
    \frametitle{Go Ahead, Make My Day}
        \begin{center}
            \movie[%
                height = 6cm,%
                width = 6cm,%
                showcontrols,%
                poster%
            ]%
            {\includegraphics[width=0.5\textwidth]{example-image}}
            {SampleVideo}
        \end{center}
    \end{frame}
\end{document}

Note that:

  • You must explicitly give your video file extension in your tex code (e.g. SampleVideo.avi, or SampleVideo.mp4);
  • The video file must be located in the same folder than your pdf.
  • You must have H.264 codecs installed on the computer.
ebosi
  • 11,692
  • 1
    I install Okular. The movie look like to play but nothing is read. May be an other problem with my code or my movie. Thanks for your help – Bugsyaya Apr 05 '16 at 14:51
  • It was the case for me indeed. But suggested MWE in the edit of my answer works fine for me. (Okular: 0.19.3) – ebosi Apr 05 '16 at 15:28
  • I have Okular: 0.19.3 too. I read if we don't add \usepackage{media9}, the movie is not really add to the PDF. And when I add poster, I can't play the movie.. I don't understant how your movie can play. But I test your code with an other movie, I add the package media9 and it's works. The only difference between my two movies are the extention. – Bugsyaya Apr 05 '16 at 15:58
  • I recompile and test it again... it works. But I found that SampleVideo2.avi should be in the same folder than your PDF. Moreover, you must explicitly give the movie file extension in your .tex document (e.g. SampleVideo2.avi and not SampleVideo2). It also worked for me with .mp4 file. – ebosi Apr 06 '16 at 06:53
  • 2
    It's works ! :D The problem was I havn't H.264 codecs installed on my computer... Thanks a lot for your help ebo :) – Bugsyaya Apr 06 '16 at 13:43
3

I added it as a hyperlink:

\href{movie.avi}{\includegraphics{movie.jpg}}

It's not embedded in the .pdf, but works with *.avi in the same folder as .pdf. Works with or without Acrobat Reader.