We have not been able to loop anything else than MPEG-2 Transport stream
Our recording and streaming setup uses several video loops:
- When not streaming talks, we show a loop with the logo of the conference, as well as the logos of the conference sponsors if applicable. This is called the sponsor loop (
- While streaming, in some composite modes (side-by-side equal and side-by-side preview), some space is available to show a background. Voctomix allows us to display arbitrary video there, and we usually generate a video loop from one or two static images. This is called the background loop (
Both loops can be generated from the same sets of commands, described below.
Creating a loop from a single static image¶
If you only have a single image,
ffmpeg can create a video loop for you:
ffmpeg -loop 1 -i loop.png \ -c:v mpeg2video -pix_fmt:v yuv420p -qscale:v 2 -qmin:v 2 -qmax:v 7 \ -keyint_min 0 -bf 0 -g 0 -intra:0 -maxrate:0 90M -t 10 loop.ts
This will create a 10 second loop file.
It can also do effects, like this which fades between colour and greyscale:
ffmpeg -loop 1 -i loop.png \ -filter_complex "[0:v] scale=1280x720 [scaled]; [scaled] hue='s=sin(.5*PI*t)+1' [vid]" \ -map "[vid]" -c:v mpeg2video -pix_fmt:v yuv420p -qscale:v 2 -qmin:v 2 -qmax:v 7 \ -keyint_min 0 -bf 0 -g 0 -intra:0 -maxrate:0 90M -t 10 loop.ts
Creating a loop with a fade-in from multiple images¶
You can also use
ffmpeg to create a loop out of multiple images with a
fade-in between them.
Start by building a series of slides as separate PNG files. Make sure they all use the correct resolution (1280x720 in our case). To get a proper fade-in, add “blank” slides in between.
Slides should be named in a sequential order, starting from
01.png. If you
need some slides to be longer, you can double them.
Once your slides are ready, you can run this script to create the loop:
$ ./loop_transition.sh path_to_slides_dir
loop_transition.sh script currently requires a version of
more recent than the one in Debian Stretch (
3.2.14). The Buster version
4.1.3) is known to work.
Safe zones for the background loop¶
For obvious reasons, the background loop gets completely masked by the composited videos. This means that special care should be taken to ensure that the content of the background loop is visible at all times, or that the content gets blocked completely in one of the compositing modes, while being displayed completely in the other.
To help the process of creating a background loop, the following svg file contains the following layers, from bottom to top:
- A background checkerboard for size reference;
- Screen captures for both of the composite modes that show the background;
- Safe zones that are either always visible, or only visible in one of the composite modes;
- Solid blocks mimicking both composite modes, to double check that your background looks sensible.
You can download the svg to use as a template, playing with the layer visibility settings to check whether the background has a sensible rendering.
As a background, we suggest a solid color or a light gradient (matching the conference theme), and adding a logo and/or some text (e.g. dates) in the “visible in both composite modes” zones only. If that doesn’t suit you, you can try having redundant content in the “side-by-side equals-only” and “side-by-side preview-only” zones, but this usually looks worse than just static content.