4

I would like to have text being displayed on top of a video. I tried both multimedia and media9, as soon as the video starts, the text disappears. I also tried creating multiple tikzpicture environments, without success.

Here is the MWE

\documentclass{beamer}
\usepackage{multimedia, tikz}
\begin{document}
\begin{frame}[plain]
\begin{tikzpicture}[remember picture, overlay]
\node[at=(current page.center)] {\movie[poster, open]{}{video.mov}};
\node[at=(current page.center)] {Isn't it possible to display this text over the video??};
\end{tikzpicture}
\end{frame}
\end{document}
7
  • 1
    No, it is not possible. Video is displayed within so-called PDF Annotations which live in a separate layer on top of the page content. The same applies by the way to other annotation types such as links.
    – AlexG
    Commented May 17 at 11:55
  • If the text is entirely within the borders of the video, you could use a video editing tool to embed the text in the video. If you don't need anything fancy, you could use ffmpeg: stackoverflow.com/a/50749822/2777074 Commented May 17 at 11:58
  • I'll have to do this then… however it was not just text but full tikz illustrations :/ But thanks.
    – Jav
    Commented May 17 at 12:03
  • @AlexG, can you make it an answer instead?
    – Jav
    Commented May 17 at 12:04
  • 2
    @Jav You could create an image from your tikz illustrations and add it to the video, e.g. video.stackexchange.com/a/32349 Commented May 17 at 12:33

2 Answers 2

7

It is possible with SVG. Unlike PDF, HTML5 standards and their implementation by modern web browsers indeed allow overlaying video content with graphics and text. The example below embeds a YouTube video, but local embeds are possible too (see media4svg documentation and examples).

Click to open:

Typeset with

latex example
latex example
dvisvgm --font-format=woff2 --bbox=papersize --zoom=-1 --page=- --linkmark=none example
\documentclass[dvisvgm]{beamer}

\usepackage{media4svg}
\usepackage{tikz,graphicx}
\usetikzlibrary{ducks}

\setbeamertemplate{navigation symbols}{}

\begin{document}

\begin{frame}{Graphics over video}
  \begin{tikzpicture}
  \node[inner sep=0pt]{\includemedia[width=\linewidth,height=0.5625\linewidth,youtube,controls]{}{5p_SuO96Jd4}};
  \pic[duck/water=blue,shift={(2,0)},scale=0.4] {duck};
  \end{tikzpicture}
\end{frame}

\end{document}

By design, video and other interactive elements are implemented in PDF as so-called PDF Annotations that live in a separate layer on top of the page content. Therefore, they are always displayed on top of text and graphics, no matter in which order they appear in the TeX input. As for hyperlinks, the link text is part of the page content, but the link rectangle is part of the PDF annotation.

\documentclass[border=5pt]{standalone}

\usepackage{tikz}
\usepackage[urlbordercolor=blue]{hyperref}

\begin{document}

\begin{tikzpicture}
\node [anchor=west] {\Huge\url{https://ctan.org}};
\node [fill=green, inner sep=2cm] {};
\end{tikzpicture}

\end{document}

![enter image description here

4

Instead of using tikz overlays to add texts or images, you could use various video editing tools to directly add the text or image to your video.

https://video.stackexchange.com/a/32349 shows an example how to add an image on top of your video. So if you have some nice video of a "pond", you could add some ducks with

ffmpeg -i Stunning_Heddon_s_Mouth_-_North_Devon_Coast_Devon_UKDaysOut-Emma_Spears-UYkjBbnVt1c.mp4 -i DuckScout.png \
-filter_complex "[0:v][1:v] overlay=25:255:enable='between(t,0,60)'" \
-pix_fmt yuv420p -c:a copy \
output.mp4

enter image description here

You must log in to answer this question.

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