SMILES now just $11/L!

Categories
HerpDerp The Diary of Lupin Pooter
Digital sign at an Esso station promoting a customer-rewards program or special pricing for holders of a particular credit card or some such thing.

The video clip embedded above was cropped and tweaked from video recorded using a handheld mobile phone, aimed outwards through a vehicle windshield during refueling at an Esso station in Hong Kong.

There’s some interesting glitchiness that, to me, is most noticeable in the pulsing effect in the checkered sleeves on the traffic cones. It’s a consequence of my having run the original video through vidstab, a video stabilization tool. I used ffmpeg and ran the following commands cribbed from Video Stabilization With ‘ffmpeg’ and ‘VidStab’(posted on April 30th, 2021 by Paul Irish on his blog):

ffmpeg -i clip.mp4 -vf vidstabdetect -f null -
ffmpeg -i clip.mp4 -vf vidstabtransform clip-stabilized.mp4

It worked well and removed much (though not all) of the side-to-side and up-and-down jitters stemming from holding the phone rather than using some sort of mount (e.g. a tripod or bendy-tripod of the gorillapod variety). The gradual downward drift, however, remains.

You may be wondering how much jitter there was to remove in the first place. Using the Python script examples on vidstab‘s PyPI page, I generated these plots of video trajectory:

'Trajectory' of the video in the horizontal and vertical planes.
Trajectory of the video in the horizontal and vertical planes.

What the plots are showing is that, from the beginning to just before the end of this clip, the camera drifted slightly to the right and more severely downwards. I don’t know units are being used for dx and dy (i.e. Δx and Δy). At a change of nearly 40 whatevers in the Y plane, it can’t be percentage change. Maybe it’s pixels (approximately 40-pixel vertical slump in a 1000-pixel+ video may make sense). At the end of the clip, the camera moved precipitously, reflecting the shakey-shake as I was about to press the stop-recording button on the phone’s screen.

Using another script from the same PyPI page, I generated a version of the original stabilized clip with wide black borders to make the jitter more readily apparent:

Black borders around the stabilized video. Watch the movement of the borders to get a qualitative idea of the jitter.

This second snippet of video is roughly half the duration of the one embedded at the top of this entry because I didn’t bounce it this time. Often, for clips I share here, part of my workflow is a step where I append a reverse-ordered copy of the frames to mitigate the distracting jump effect you’d otherwise get each time looped playback moved from the final to the first frame, whether from physical drift of the camera during recording or from changes in whatever I was videoing.