Monday, November 27, 2017

"Pause" t-shirts redux

It's the design that keep on giving!  The t-shirt design I co-created for a youth ministry Disciple Now event back in 2011 and was re-used by another ministry in 2012 seems to have a life of its own.

Back in September of this year, I was approached online by John Copeland, a youth pastor from Georgia, who had stumbled across the blog post I wrote about those "Pause" t-shirts.  As it turns out, his youth group was in need of a similar event tee, so he reached out to request permission to use the design.  As I've demonstrated before, this is perfectly acceptable (and appreciated) request to make!  So, naturally, I was happy to see the design used yet again by someone else.

When it was all said and done, I was even able to connect John with the fine folks at Contagious Graphics, who still had the design artwork on file from the first time they printed up the shirts.  All I asked in return from John was that he send me a photo of his youth group wearing the shirts, and I was so pleased this morning to see that he had made good on his promise!

Thursday, November 2, 2017

Custom countdown video generation (the ... complicated way)

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!