Loop video using Optical Flow and Metal on iOS


The app loops video to make an effect like it is endless, it uses optical flow algorithm to detect the difference between the cut-frames to make a seamless fade transition. For example, it can be used to create smooth looped TikTok videos or NFTs. This is an experiment and my first completely SwiftUI app, it’s made for fun but the result is preaty cool.

How to use?

  1. Select video from gallery (it will work the best with short videos ~10 seconds, preferably if its background is more or less scatic).
  2. Using sliders find two most similar frames from two equally divided parts of the video.
  3. Tap the process button to see the result.

App Screenshots

Onboarding screen Main screen Processing Video screen Settings screen
Simulator Screen Shot - iPhone 13 - 2022-08-13 at 22 03 12 IMG_4065 2 IMG_4064 2 IMG_4066 2

Demo of Looped Video



Thank to for the idea to use optical flow.


View Github