Myth of the One-Day App, Week 2

Honestly, I never really considered ffmpeg. That would have been a fair bit easier. I was still reeling from the iMovie 1080p betrayal (see previous post), but also the reality that I was still three videos short – I did, after all, need to make promos for the other language-versions my app was supporting. I would need to translate, then duplicate the project, and then do a fair bit of copy/pasting. On top of which, if I needed to change one video, I’d need to apply the same change to the others, effectively quadrupling my workload.

Well, I wasn’t having that. I had a crazy idea to solve all my problems in one fell swoop, and it was this:

I was going to code my own iMovie, and I was prepared to spare myself a week to do it.

One Week Project!!

Now, titter ye not! Hear me out:

iMovie hasn’t really changed in years. And – sorry, Apple, you know I’m saying this out of love – it’s really showing its age. The effects are simple; most look downright amateurish through my 2023-goggles. While they may be great for impressing young kids, they don’t pass any muster compared to other (expensive) software. I’m sure this is by-design. Free software from big corporations is usually only there to whet appetites for their better, expensive software.

Fantastic transitions, McFly… for 1985 daytime TV!

Meanwhile, the ability to generate video from code is straightforward enough, using the likes of AVAssetWriter. If I could generate the frames, making the video would be trivial. And I’ve been writing code to create/edit images for years.

So, I needed three things:

  • a plain-text script
  • code to read the script
  • code to generate any particular frame, and thus assemble the video

No GUI needed. Keep things simple. Then, generating different versions, with resolutions/frame-rates/languages would be a snap.

What effects would I need?


  • fade/dissolve (the only transition you ever really need)
  • “typing” text
  • backgrounds (preferably, moving ones)
  • object positioning, scale & alignment

That’s not a lot to do, really. A week sounded fair (he said, optimistically).

Yes, I was doing it again: starting a new project to complete an old one. But this one would be genuinely useful for future promos, and who knows what else?

In case you’re curious how my week went:

Week 2, Day 1: (Wednesday 15th February)

  • Code to create a video from images
  • Code to create a short video moving background

Week 2, Day 2:

  • Transfer iMovie project to a plain-text script
  • Setup data structures for objects, effects & transitions

Week 2, Day 3:

  • Code to load from the plain-text script
  • Sequencer to organize which objects are shown in which frames

Week 2, Days 4 & 5

  • Weekend, but I did do a little sequencer work to get fade transitions working

Week 2, Day 6:

  • Code to extract images from videos
  • Code to make images from PDF files

Week 2, Day 7

  • CoreText work to offset individual character y-positions
  • Typewriter effect

Oops, there went my week, and still a fair chunk more to go… But, realistically, my one-day app was already two weeks overdue, so did you really expect me to replicate iMovie functionality in just one week?!


Legend/Myth of the One-Day App, Day Seven

So, I prevaricated enough and the time was nigh to venture forth onto the developer site and get my app submitted for release. It was Valentine’s Day, a day that I loathe on principle, but, for the sake of my long-suffering wife and my own crumbling sanity, I needed to seize the nettle by the horns before I succumbed to my own madness and mixed metaphors.

The first thing I found out (as mentioned back in the original post, with all that future knowledge) was that my app’s name was already taken. I couldn’t call it Sleep Tight. So, after much petulant stomping about and hissing, I renamed it Sleep Well and tried to ret-con that title within my brain. Almost two months later, I am only just getting used to it.

Sleep Well is an app I use everyday and I love it, but I had no clue how desirable the great Not-Me might find it. After all, it was an app that fixed a problem that might only be peculiar to my Mac. And, as an app with just one button, were people going to chance their spare coffee money on it after glimpsing one screenshot?

No way in hell, I thought.

But imagine if they could see it in motion…

A little less of a long shot?

Yes: what this app needed was… a promo video!

Video Killed The iMovie Star

Yes, a promo video! I could waste days more on that…!

Oi! No! That’s not what I wanted! I resolved that I could come up with a perfectly serviceable video in just one remainder-of-a-day, render it and be done. Day 7, then. Finished in a week, and only the Almighty could say better that that!

Now, I don’t own any fancy software for videos or video-capture. But MacOS has inbuilt video capture (Cmd-Shift-5), and I remembered using iMovie in the dim-and-distant, so I would use those two tools.

Cmd-Shift-5 (what else shall I call it?) is a lovely little app. And it seemed to be just the ticket for me: I could place my app window over the desktop, select a region for capture and just hit the record button.

Unfortunately… it pretty much fails to capture when a Mac goes to sleep. Not so unsurprising, that. But since Sleep Well‘s #1 task was to put the Mac to sleep, getting a “good” recording, especially for those precious moments after the Mac wakes up, proved impossible. Would any other software work any better? Probably not. There was only one thing for it: Sleep Well needed a “fake sleep” mode.

This “fake sleep” would simply involve hiding the Sleep Well window behind its black screen when asleep, and show it again on waking up. It was a “feature” needed only for the sake of the promo video, and wouldn’t show up in the submitted version.

That worked. Cmd-Shift-5 offered up no more protests. My only problem was moving my mouse cursor properly. I’m serious: as soon as I hit record, my hand started becoming extremely mal-coordinated and jittery. I needed several takes to get it right. This is why I could never be a stage actor: I’d trip over my own face standing still.

I also needed to generate several other “screens” to stitch together for the video. It wasn’t too much of a hassle. I imported everything into iMovie, added some text, jiggled it all about a bit until it was “that’ll do” quality, and then hit the render button…

The magic of iMovie…

…And it turned out okay, so I attempted to upload it to Apple and then…

“Resolution not supported!”

I had rendered it in 720p. In my defence, my app has one button and a tiny window, so why did it need to be 1080p? Well, it just did need to be, didn’t it! So I went back to iMovie and then I noticed something horrible: iMovie wouldn’t let me render it above 720p.

what a lovely “feature”

It seems to be a rather-well-known bug in iMovie. Unless you have 1080p video “pieces”, it won’t scale up to 1080p. Why? Don’t ask me why! It seems absolutely nuts. But what do I know? Perhaps Apple want every bit of output to be crisp and un-blurred so, rather than have people complain about their mildly-blurry renders, they cheerfully disable the 1080p option for a video that might be better suited to 720p, no matter what the user wants…

Was there a workaround for this bug? Well, the solutions described after a long web-search did not fix it for me. Had I wasted my day on this? As I saw it, I now had three options:

  1. chalk the day off to experience, and submit the app without a video; or
  2. buy some better movie-generating software; or
  3. use ffmpeg or similar to up-convert the already-generated 720p.

I engaged Hubris Mode and chose option 4.

(to be continued…)