Pandemic Journal, Day 614

A few days ago, I wrote about optimizing the process of extracting short segments from a video file to avoid having to copy the entire source video. My improvement was simple, elegant, and wrong – when I looked at the video I created, it didn’t start where I expected; it started and ended early every time. I “fixed” the problem by telling the program to add a little time at the end and by using QuickTime to trim the video by hand, but that seemed silly.

Today I figured out the problem. I’d assumed that when I told ffmpeg to extract a piece of video starting at a particular time, it would do that – but it can’t. It has to back up to the most recent “key frame” in the video, so the starting point will be a little earlier than specified, which threw off the rest of the calculations in the script and gave me a trimmed video that started and ended too early.

So in the end, I wound up writing unnecessary (and ugly) code that did more processing than necessary to extract a clip that I still had to edit manually anyway.

Premature optimization is the root of all evil.

Pandemic Journal, Day 613

I got a message from the Post Office around 8am, telling me that the coffee they didn’t deliver yesterday (“at customer request”) was out for delivery again – and it arrived around 2:30pm. I opened the box to make sure it was what I’d ordered and put it away; I won’t need it for at least a week.

I’d also ordered bagels from New Yorker Bagels for this weekend – they ship FedEx Priority Express, so they were supposed to arrive before 1pm. But at 1pm, they were still “at FedEx location” – but they arrived just before 4pm, in plenty of time for lunch tomorrow.

And I found that I can use QuickTime Player to trim video clips, which means I don’t have to specify precise timing when I run the script I talked about on Wednesday to clip a piece of video from a movie. Trimming a second or two from a 30-second clip is easy in QuickTime; using it to pull a short segment out of a longer video would be much more finicky.

613 days…that’s one per mitzvah. Hard to believe!

Shabbat Shalom!