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.
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.
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?!