At Providence Baptist Church, where I serve on staff as Worship Leader and Technology Coordinator, we occasionally employ countdown videos ahead of our worship service start times. Now, a countdown video is little more than a video clip that shows a "minutes:seconds" countdown, usually overlaying some subtle motion graphic loop or still image. You can buy these things from media sites (such as Worship House Media) for a nominal fee, often as part of a collection of videos which bear a common visual theme — a countdown video, a few motion loop videos without any overlaid text, etc. But sometimes I want a countdown video that I can't purchase, perhaps because I don't like the font, font size, positioning, or background motion loop of what is available for purchase.
Now, I'm sure that expensive video editing software can generate these things willy-nilly with full customization. But I'm not really an expensive-video-editing-software kind of guy. I'm familiar with a handful of less-expensive (or free) options, though, and many of these offer the promise of a workaround for my itch to design custom countdown loops. So tonight, I decided to see what I could work out using my current favorite of these editors, VideoPad.
Like many other timeline-based video editors, VideoPad allows you to create text objects which can overlay another video track. I figured that if I could create a VideoPad project with a whole track full of 1-second text objects, each of which showed the countdown text I wanted ("4:59", "4:58", "4:57", and so on), I could use this as a template for various specific countdown timers in the future. I'd simply swap out the still frame or motion loop video that served as the background, and re-render as needed. But it only took me a few minutes to realize that I really didn't want to manually create and sequence 300 of these frames (5 minutes x 60 seconds per minute).
So I took a slight detour. What if I could reverse-engineer the VideoPad project file format? Was that possible? It only took a few minutes to realize that VideoPad project files are simple text files with Unix line endings and URI-query-encoded lines of data. Unfortunately, while I could make sense of much of what I saw in my sample project file, I failed to successfully edit it to affect a simple change — the addition of one more countdown text object properly sequenced.
I was about to give up hope, when I remembered that VideoPad also supported the use of PNG image overlays — with full alpha-channel support! If I could generate 300 PNGs, each one a transparent rectangle with the countdown timer text rendered in the frame, then VideoPad would let me import those as an image sequence (much like the "create a slideshow" feature of other editors) and then I could layer that whole sequence atop the background still/video of my choosing! Finally, I was in familiar territory.
After about a half-hour of hacking around with Python and Pillow (née the Python Imaging Library), I had something that worked for my purposes! I quickly generated the 300 image files, successfully imported them into VideoPad, shoved another motion loop video underneath them, and rendered my first custom countdown video! And since my wife and kids were away from home, I then spent another hour polishing up my script a bit more, allowing it to be driven with various options (controlling the size of the generated frames, the font specifications of the countdown text, and the rough positioning of the text), adding some error-checking and documentation, and published the result to Github as gen-countdown-frames.
To those with oddball interests and similar needs: you're welcome!
haha... neat!
ReplyDelete