23

I want to know the procedure to embed video and animation in LaTeX step by step. I tried to follow the instructions from this forum and wrote a LaTeX file. This is my code for embedding a video in LaTeX beamer...an icon is visible in the third slide but when I am clicking that video is not playing...I have tried with .avi file also. I do not know what went wrong

\documentclass{beamer}
\usetheme{CambridgeUS}
\usepackage{graphicx}
\usepackage{verbatim}
\usepackage{multirow}
\usepackage{ctable}
\usepackage{geometry}
\geometry{verbose,letterpaper}
\usepackage{movie15}
% \usepackage{media9}
\usepackage{hyperref}
\newcommand{\fullpage}[1]{
\begin{frame}
 #1
\end{frame}
}
\author{~}
\institute{Linux Community}
\title{Emdedded Video on Latex}
\begin{document}
\frame{ \titlepage }
\fullpage{See Demo video}
\begin{frame}
abc
\includemovie[poster,autoplay,externalviewer, text={\small(Loading bloch.mp4)}]{6cm}{6cm}{bloch.mp4}
% \includemedia
% [
%   activate=pageopen,
%   width=200pt,height=150pt,
%   addresource=bloch.mp4,
% %   text={\small(Loading bloch.mp4)}
%   flashvars={%
%      source=bloch.mp4% same path as in addresource!
%    &autoPlay=true%    % optional configuration
%    &loop=true%        % variables
%   } 
%   ]{}{VPlayer.swf}

  def

\end{frame}
\end{document}

I would be really grateful if someone helps me out.

6

3 Answers 3

7

In addition to Karl's students answers (Can we use media9 to show a video on a PDF but the video is not embedded to the PDF?) and this other question: gif image in beamer presentation I can suggest what I did for my thesis presentation:

In the preamble of the beamer:

%Graphics and Videos
\usepackage{graphicx} %The mode "LaTeX => PDF" allows the following formats: .jpg  .png  .pdf  .mps
\graphicspath{{./PresentationPictures/}} %Where the figures folder is located
\usepackage{media9}
\addmediapath{./Movies/}

And then I included my file like this:

\begin{frame}
\frametitle{Forward Kinematics}

\begin{center}
\includemedia[
    activate=onclick,
    width=0.75\textwidth
]{\includegraphics{FK3.png}}{FK3.swf}
\end{center}
\end{frame}

As you can see, I used the .swf file extension. I too had a .avi file and in order to convert it to .swf I used AnyVideoConverter.

I hope this helps

3
  • 2
    What is FK3.png? Just the fisrt frame of the video as a placeholder until the video starts?
    – Jonny
    Jul 6, 2015 at 16:56
  • 3
    @Jonny Exactly. You can use any image you want Jul 10, 2015 at 10:40
  • Thanks for this. This is the only option that worked for me. To convert to SWF, you can use ffmpeg, with the command line: "ffmpeg -i Source.flv -acodec copy Destination.swf".
    – cfp
    Jun 18, 2018 at 9:34
7

Below is the code about how I solved it using multimedia package. Someone can add an image also to avoid a black spot in the allocated space for the video.

\documentclass{beamer}
\usepackage{graphicx}
\usepackage{multimedia}
\begin{document}
\begin{frame}{movie}
\begin{figure}[h!]
\centering    
\movie[label=show3,width=1.0\textwidth,poster
       ,autostart,showcontrols,loop] 
  {\includegraphics[width=1.0\textwidth]{image.png}}{image.mp4}
  \caption{caption}
 \end{figure} 
  \end{frame}
 \end{document}
3
  • 4
    The code doesn't work (my .mp4 doesn't play, although it does in vlc), regardless of the presence of an image. I have TeX, Version 3.1415926 (TeX Live 2013/Debian). Maybe it's too old?
    – jaam
    Mar 24, 2018 at 13:30
  • 1
    Codec issue? Just a wild guess. May 21, 2018 at 16:59
  • 2
    this code makes a useless play button inside the PDF. Does not work.
    – con
    Jan 21, 2020 at 15:26
4

So here is my workaround for this. It opens your standard video player when you click on the image.

\documentclass{beamer}
\usepackage{multimedia}
\begin{frame}
\centering
\movie[externalviewer]{\includegraphics[width=1.0\textwidth]{image.jpg}}{video.mp4}
\end{frame}

p/s: add a curly bracket

2
  • 4
    Isn't the code missing a curly bracket and should look like this: \movie[externalviewer]{\includegraphics[width=1.0\textwidth]{image.jpg}}{video.mp4} ?
    – Marcus
    Jan 5, 2021 at 18:17
  • Hi, Its still not working. Any other suggestions, please? Aug 12, 2023 at 11:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .