Friday, March 17, 2023

How to make a video look much smoother, without (greatly) increasing the file size?


I’m often annoyed when looking at a film or short video that looks jittery or stuttering, as if the makers haven’t given it the love it should have received when recording or editing.

I’ve also noticed that my eyes are a little bit better than most peoples’  that I’m a minority for noticing or being troubled by this at all. 

Stuttering or Jittery video?


To illustrate what I even mean by “jittery or stuttering” I’ve made a screenshot from a video that is part of my favourite study bible at Jo 4:20,21. You can find this video at this link

In this video, we see the ancient Samaritan area with mount Gerizim. Then, the camera pans left and we see the low plains with the current-day-city Nablus. While the camera pans left, the video is stuttering. Let me try to show you this with a short video that I will shoot with my phone camera.  Here it is:




Now, having established that there really is a problem, I would like to show you a simple solution.

You see, we’ve walked on the moon more than 50 years ago. My watch has more computing power than all the computers at NASA in the ’60 combined. There is no reason on earth why we still need to create video files with only 24 frames per second.

The solution: “upscaling” the frame rate with FFmpeg.


Through the arcane art of using FFmpeg with it’s ML-supported frame rate upscaling, it is perfectly possible to turn a so-so source file into a much more enjoyable output. 

Of course, the information that isn't in the video file has to come from somewhere. The filters in the FFmpeg software don't run on the clever Machine Learning models that, say, an iPhone's Image Processing know how to fabricate. The FFmpeg software simply looks at a frame and the next frame, and calculates what should go in between. This simple trick, however, is good enough to fool our human eyes.

So, the exact command is:

  • ffmpeg -i [input.mp4] -vf minterpolate=fps=60 [output_60fps.mp4] 


Where the filename of the input and output are between [brackets]. 

The source file has a frame rate of 24 frames per second at a resolution of 1280x720:




After entering the command, my M1 chip powered laptop spent a whole 5 minutes and 45 seconds on this conversion. I would be truly interested to find out how long short it takes on an M1Pro or a M2-powered beast machine?


The result?


The resulting file has more than double the frame rate and is somehow about 3 MiB smaller 🤔



But more importantly, the so troubling stuttering or jittering has now melted away like snow in the sun:



Why not do this? 


If I had to be generous, I could imagine that, to save underpowered feature phones that most of LATAM and Africa use, the makers of these videos deliberately choose not to add a higher frame rate. After all, much more annoying than a stuttering video is a video that is not playing at all because of device constraints that you, the user, do not understand. 

This argument can, however, easily be muted by the simple fact that this website (jw.org) as well as the JW Library app, serve you options: You can go as small as a 240p file. 

So, why not make the largest file at a higher frame rate and keep all the more budget friendly options on the current regime? 

I really don’t know. It seems to me a no-brainer with lots of upside and virtually no downside. But maybe I’m missing something? 

I would love to hear your thoughts? 😊

Edit: You can post your input on Hacker News: https://news.ycombinator.com/item?id=35195095 

No comments: