Create videos from your documents
Sometimes it's easier to communicate ideas with video. People can watch videos at their leisure, take in information at their own pace, and pause when needed. For presenters, sharing information over video frees up time that would've otherwise been spent in a meeting presenting the information. If you have documents like Google Slides, Microsoft Powerpoint, or PDFs, these can all be converted into a simple video slideshow.
Using ImageMagick and FFmpeg, we can convert a document into a video slideshow with audio. To follow along, make sure you have both programs installed. Instructions for installing ImageMagic can be found here and instructions for FFmpeg are here.
Prepare your document
To convert a document into a video, it first needs to be in PDF format, and then converted into images. If you want to convert a slideshow into a video, export it as a PDF file first.
In your terminal, run the following ImageMagick command to transform a PDF into a set of image files:
convert -density 300 document.pdf -colorspace sRGB -background remove -alpha off -quality 100 document-%03d.png
Transform document into a video
Now that you have a set of images for your PDF pages, run the following FFmpeg command to transform the images into a video slideshow with your desired audio file.
ffmpeg -framerate 0.25 -i document-%03d.png -i audio.mp3 -vf "pad=ceil(iw/2)*2:ceil(ih/2)*2" -c:v libx264 -pix_fmt yuv420p -c:a copy -t $(echo $(($(ls -1q document-*.png | wc -l) * 4))) document.mp4
Here's an example of a Google Slides presentation transformed into a video with an audio track using the commands above.
Follow Cosmos Media for more tips on automating your media workflow and our blog, for more video engineering content.