I figured it would be possible to turn a presentation to video so that the package highlight can be condensed in short watching. The documentation already had all the examples. Thus it was mostly stitching all things together: starting with a quarto revealjs file, ending with a video that even has music.
Overview
ggindex-showcase.qmd
│ quarto render
▼
ggindex-showcase.html revealjs deck
│ chromium --headless --print-to-pdf (?print-pdf&pdfSeparateFragments=true)
▼
deck.pdf one page per step
│ pdftoppm
▼
frame-01.png … 1920×1080 images
│ ffmpeg (crossfades, fades, music)
▼
ggindex-showcase.mp4
The Video
The steps explained
All of this runs on Linux. I am not sure if it would run on Windows, MacOS is probably fine.
1. Render the deck
quarto render runs the R code and writes ggindex-showcase.html.
- The slides are 1920×1080, the size of the video.
output-location: column-fragmentin the yaml header puts the code and its plot side by side and shows them in two steps.plot-first.htmlis a small JavaScript snippet that swaps the order, so the plot is shown first and the code appears next to it. The plot then stays on screen for both steps.
2. Print the deck to PDF
A revealjs deck is a web page, and its layout only exists after a browser has run the reveal.js JavaScript. Headless Chromium opens the deck and prints it to PDF. Two reveal.js URL options shape the output:
?print-pdflays out every slide as one page.pdfSeparateFragments=truegives every step its own page, so the plot-only step and the plot-plus-code step become separate pages.
Headless Chromium is needed because Quarto has no direct revealjs-to-PDF export.
3. Turn PDF pages into images
pdftoppm writes each page as a 1920×1080 PNG.
4. Build the video
ffmpeg does the rest in a single filter graph:
- Frames. Each PNG is shown for the given seconds per step.
- Crossfades. Consecutive frames blend over 0.5 s (
xfade). - Fades. The video fades in from white over 0.8 s and out to white over 1 s.
- Music (optional):
- The track is repeated as often as needed to cover the video. The copies are joined with a 1 s crossfade (
acrossfade), so the restart is smooth. - It is cut to the video length, starting at the given start time (
atrim). - It fades in over 1 s and out over the last 2 s.
- The track is repeated as often as needed to cover the video. The copies are joined with a 1 s crossfade (
- Encoding. H.264 video and AAC audio in an MP4.
The music adapts to whatever length results.
The whole pipeline lives in github.com/discindo/ggindex-showcase/
See mode about ggindex on its website: discindo.github.io/ggindex/