Insert video clip in a lyx presentation and play it in GNU/Linux
Asked Answered
B

3

7

How can I insert a video clip into a presentation created in Lyx?

Have seen http://www.latex-community.org/forum/viewtopic.php?f=19&t=48. It works, but there the video starts in the background in an external player.

I would prefer it to be played in the presentation itself. If an external player is used it it should at least start in the foreground. But the presentation takes the foreground. Using evince in GNU/linux as pdf viewer. Beamer is used as a presentation template.

Is it possible to play a video file in an embedded player in the presentation itself?

Created an example presentation. The code is found below.

\documentclass[english]{beamer}
\usepackage{mathptmx}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{amsmath}
\usepackage{amssymb}

\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Textclass specific LaTeX commands.
 % this default might be overridden by plain title style
 \newcommand\makebeamertitle{\frame{\maketitle}}%
 \AtBeginDocument{
   \let\origtableofcontents=\tableofcontents
   \def\tableofcontents{\@ifnextchar[{\origtableofcontents}{\gobbletableofcontents}}
   \def\gobbletableofcontents#1{\origtableofcontents}
 }
 \makeatletter
 \long\def\lyxframe#1{\@lyxframe#1\@lyxframestop}%
 \def\@lyxframe{\@ifnextchar<{\@@lyxframe}{\@@lyxframe<*>}}%
 \def\@@lyxframe<#1>{\@ifnextchar[{\@@@lyxframe<#1>}{\@@@lyxframe<#1>[]}}
 \def\@@@lyxframe<#1>[{\@ifnextchar<{\@@@@@lyxframe<#1>[}{\@@@@lyxframe<#1>[<*>][}}
 \def\@@@@@lyxframe<#1>[#2]{\@ifnextchar[{\@@@@lyxframe<#1>[#2]}{\@@@@lyxframe<#1>[#2][]}}
 \long\def\@@@@lyxframe<#1>[#2][#3]#4\@lyxframestop#5\lyxframeend{%
   \frame<#1>[#2][#3]{\frametitle{#4}#5}}
 \makeatother
 \def\lyxframeend{} % In case there is a superfluous frame end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\usetheme{Warsaw}
\usepackage{hyperref}

\makeatother

\usepackage{babel}

\begin{document}

\title{Testing video}

\makebeamertitle

\lyxframeend{}\section{Testing video}


\lyxframeend{}\subsection{Testing video}


\lyxframeend{}\lyxframe{Testing video}

\href{run:video.wmv}{Movie}

\appendix

\lyxframeend{}
\end{document}
Backdate answered 11/3, 2010 at 20:18 Comment(6)
1. Does evince support PDF media? 2. did you follow the instructions in the forum post and export the code from lyx, then compile with PDFlatex? 3. Can you post up your code?Perbunan
Have added the code for a simple example above. Exported the presentation to pdf with pdflatex directly in lyx. Have tested both with evince and okular. They have both the same behavior. The movie opens, but in the background of the running presentation. I do not know if any of them supports pdf media.Backdate
if you can get a computer with Adobe Reader on it, I would try it in there. The Evince and Okular both use popplar to render PDF, and the Okular homepage says that it doesn't support videos in pdfs yet.Perbunan
also, export your code out of lyx into latex (the code you've posted looks like a lyx file, but you need straight latex). Then compile the resulting .tex file via the command line by issuing pdflatex filename.texPerbunan
Exported it to latex code. The result is above. And the above command gave me a number of files. I then opened the .pdf in acroread. The first time I click on the video, I get an error saying "There was an error processing an action. Failed to load an application resource(internal error)". But if I try again, the video opens in Firefox. This will probably be because of the "href" in the movie line. "\href{run:video.wmv}{Movie}"Backdate
I would hardly think that Adobe is going to support wmv-- especially on your linux box.Perbunan
D
1

How to insert video clips into PDF produced with LaTex, see: http://www.uoregon.edu/~noeckel/PDFmovie.html (using movie15 package).

Unfortunately, you can insert, but you cannot play that video on Linux (evince & okular don't support it, acroread plays it only if you have installed realplayer and are really lucky). Such video-in-a-PDF is playable on Windows.

You can produce cross-platform animations in PDF (not video) by using animate package and tikz/pgf. They play both in Linux and Windows acroread (if JavaScript is enabled) (but not in evince nor okular).

Otherwise you can create presentations with OpenOffice Impress or S5, both allow to embed videos easily, and both play well on Linux. For PDF putting a hyperlink, like you do, seems to be the most reliable way.

Distefano answered 12/4, 2010 at 13:59 Comment(0)
C
5

It seems that what you're asking for is (now, maybe not previously?) possible using Okular as the viewer. Be sure to include \usepackage{multimedia} in the LaTeX preamble, then you can add in ERT:

\movie[
height = 0.6 \textwidth, 
width = 1.0 \textwidth,
showcontrols
] 
{} {movie.mp4}

This (sort of) works on my system though most of the options for the \movie command don't work, like poster, autostart, etc. However showcontrols does work -- though if the movie runs to completion, then the controls disappear until the presentation is restarted. Nonetheless, I didn't know of any way to have movies embedded in Linux before so it's a start.

For the record I have Ubuntu 10.10, with Okular 0.11.2. I'm also using LyX 2.0.0 which is pretty new but I don't think the LyX version should matter.

Some helpful links:

Cuspidate answered 13/6, 2011 at 19:20 Comment(1)
With TeX Live 2015 and Okular Version 0.24.2 this solution does not work. There are no compilation errors, but Okular only displays a blank space.Harsho
D
1

How to insert video clips into PDF produced with LaTex, see: http://www.uoregon.edu/~noeckel/PDFmovie.html (using movie15 package).

Unfortunately, you can insert, but you cannot play that video on Linux (evince & okular don't support it, acroread plays it only if you have installed realplayer and are really lucky). Such video-in-a-PDF is playable on Windows.

You can produce cross-platform animations in PDF (not video) by using animate package and tikz/pgf. They play both in Linux and Windows acroread (if JavaScript is enabled) (but not in evince nor okular).

Otherwise you can create presentations with OpenOffice Impress or S5, both allow to embed videos easily, and both play well on Linux. For PDF putting a hyperlink, like you do, seems to be the most reliable way.

Distefano answered 12/4, 2010 at 13:59 Comment(0)
C
1

A quite non-professional way is to use the HTML5 method. Convert your document into a browser based presentation. Maybe use inkscape, or maybe convert it manually and then add the video tag

Chloroprene answered 10/5, 2011 at 7:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.