7

I am experiences some issues when including videos in my beamer presentation. Here is my frame,

\begin{frame}{Frame Title}
\movie[width=6cm,height=4.5cm]{}{videos/test.avi}
\end{frame}

The problem occurs when I set the width and the height of the video. When I enter Presentation-mode of my PDF-viewer, black spaces occur at the sides of the video.

Is there a way to completely get rid of these?

I tried forcing the background color to white before the frame (\setbeamercolor{background canvas}{bg=white}), but that didn't solve the issue.


MWE:

\documentclass[11pt]{beamer}

\usepackage{multimedia}


\usepackage{tabularx}
\usepackage{amsmath, amsthm, amssymb}
\usepackage{gensymb}

\begin{document}

\begin{frame}
\end{frame}

\begin{frame}{Frame 1}
\movie[poster,autostart,width=6cm,height=4.5cm,repeat=true]{}{rho.avi}
\end{frame}

\end{document}

The video is here: https://ufile.io/fb2de


Screenshot:

enter image description here

BillyJean
  • 1,743
  • Maybe have a look at http://tex.stackexchange.com/a/143102/36296, this shows how to include full width images. But if your video has another aspect ratio then the presentation, some margins are inevitable. – samcarter_is_at_topanswers.xyz Dec 19 '16 at 10:03
  • @samcarter Is it possible to override the margins, maybe by setting the background color or some other "dirty" trick? – BillyJean Dec 19 '16 at 10:08
  • Can you make a compilable MWE that can reproduce your situation. Maybe with some dummy video we can access? – samcarter_is_at_topanswers.xyz Dec 19 '16 at 10:22
  • @samcarter added a mwe with a video. when I enter presentation-mode with my pdf-viewer, black margins occur. – BillyJean Dec 19 '16 at 10:33
  • @samcarter I see black margins around the video in addition to the left/right margins caused by the fullscreen view. You do not see these? – BillyJean Dec 19 '16 at 10:51
  • 1
    This kind of animation could as well be embedded using the animate package, if you have the files of the single frames (preferably as original vector graphics) available. – AlexG Dec 19 '16 at 11:09
  • @samcarter Added a screenshot. I use Okular on Debian – BillyJean Dec 19 '16 at 13:17
  • @BillyJean I cannot test with okular, but maybe try with borderwidth=0pt in the options of the movie. – samcarter_is_at_topanswers.xyz Dec 19 '16 at 13:45
  • @samcarter Thanks for the suggestion, I tried it out - it doesn't remove the margin though. It is weird, because the margins only appear in Presentation-mode - when it is "normal", they don't appear. – BillyJean Dec 19 '16 at 13:57
  • You may try a 16:9 ratio: \documentclass[aspectratio=169]{beamer}. – Paul Gaborit Dec 19 '16 at 14:14
  • @PaulGaborit I tried, the margin still occurs – BillyJean Dec 19 '16 at 15:01
  • @BillyJean The ratio of your screen is 16:9 and the ratio of your video is 4:3... – Paul Gaborit Dec 19 '16 at 16:06
  • @PaulGaborit That only works for the particular video. Say I have many videos in the beamer of different size, is there a way to fix it in that case? E.g., if I can merely specify the height, then the width is chosen automatically to match that of the video? – BillyJean Dec 29 '16 at 08:21
  • I can't reproduce your problem on windows with acrobat viewer. But it looks like a pdf-viewer artifact. Instead of trying to hide the margins you could add a black frame or background around the movie to make them look intentional. – Ulrike Fischer Dec 29 '16 at 14:25
  • @BillyJean Can you please test something (I don't see these black margins, so I cannot test myself)? What happens if one draws a white frame around the boarder? `\documentclass[11pt]{beamer}

    \usepackage{multimedia} \usepackage{tikz}

    \begin{document}

    { \setbeamertemplate{logo}{% \begin{tikzpicture}[remember picture,overlay] \draw[yellow, line width=10pt] (-11.7,2.2) rectangle (-5.7,6.6); \end{tikzpicture}} \begin{frame}{Frame 1} \movie[poster,autostart,width=6cm,height=4.5cm,repeat=true]{}{rho.avi} \end{frame} } \end{document}`

    – samcarter_is_at_topanswers.xyz Jan 04 '17 at 12:48
  • @samcarter They still appear, they are now inside the yellow frame – BillyJean Jan 04 '17 at 13:58

1 Answers1

5

You can use the media9 package instead of multimedia (comes with beamer), which requires to convert your video to .mp4 first (e.g. here or wherever). It's worth the effort as media9 allows to include the video physically in the PDF, means you don't need to carry around the actual video file and you're not dependent on any codecs available on the target PC (which would be the case with an external .avi file and multimedia).

\documentclass[11pt]{beamer}

\usepackage{media9}

\usepackage{tabularx}
\usepackage{amsmath, amsthm, amssymb}
\usepackage{gensymb}

\begin{document}

\begin{frame}
\end{frame}

\begin{frame}{Frame 1}
    \includemedia[
          width=6cm,height=4.5cm,
          activate=pageopen,        
          keepaspectratio,          % optionally useful
          transparent,              % optionally useful
          playbutton=plain,
          addresource=rho.mp4,
          flashvars={
              source=rho.mp4 
             &autoPlay=true
             &loop=true}
        ]{}{VPlayer.swf}
\end{frame}

\end{document}

enter image description here

  • 4
    In case the player's and the video's aspect ratios don't match exactly (due to resampling of the video while viewing) it is worthwhile adding option transparent. It makes the player's background transparent and further reduces the occurrence of black lines around the video – AlexG Jan 03 '17 at 12:31
  • Thanks. I tried out your example with rho.mp4, but in the PDF nothing plays - it only shows a grey bar with a play-triangle inside it. Nothing happens though when I push it. Is the part VPlayer.swf correct? – BillyJean Jan 03 '17 at 12:47
  • @BillyJean : Do you use A-Reader (or Foxit or PDF-XChange) for viewing the PDF? – AlexG Jan 03 '17 at 13:09
  • @AlexG I tried with both Okular and Foxit (on Debian) – BillyJean Jan 03 '17 at 13:32
  • 2
    @BillyJean : Okular doesn't support the embedding method of media9. And only the Windows version of Foxit works. – AlexG Jan 03 '17 at 13:37
  • @AlexG I see, thanks. Wow, I have bad luck all the way with this... – BillyJean Jan 03 '17 at 15:51
  • 2
    @BillyJean : Installing and running A-Reader and FlashPlayer in Wine under Linux could be an option for you. – AlexG Jan 03 '17 at 16:06
  • 1
    @BillyJean I'm sorry, but I didn't knew there would be issues with other pdf readers. Unfortunately I can't provide another solution for them. – Robert Seifert Jan 03 '17 at 22:09