hn.today

My video has unit tests

pertiller.tech25 points11 comments
Screenshot of My video has unit tests

A 15-second promotional video for the Petroly fuel-price app was built as software rather than assembled in a video editor. A JavaScript function generates an SVG for any point in time; rendering 375 frames at 25 frames per second and sending them to FFmpeg produces the finished video. The same renderer powers an interactive browser preview, where viewers can scrub through scenes, switch languages, and inspect individual frames. The animation shows a fuel-price chart reaching a target, a notification appearing, and station listings sorting by price.

Treating the video as code makes its behavior testable and easier to revise. Automated checks verify that the alert appears only after the target is reached, sorting finishes before the cheapest station is highlighted, the QR code is laid out correctly, and every frame avoids invalid values. Pixel checks also confirm the logo actually renders. The video can retain transparent rounded corners in a ProRes 4444 editing master, and one shared animation generates 12 localized versions with appropriate wording, currencies, formatting, and QR destinations. The creator argues that tests protect a video’s mechanics while visual review protects its feel. Using JavaScript, SVG, sharp, and FFmpeg, he can review changes as code diffs, render exact frames, and update every language version without specialized editing software or separate timelines.

Read on pertiller.tech11 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Programming

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.