Video Loop Script \\ Loopy

From the 25th of April, 2020

There is a program called Boomerang that will make tiny 1 second looping videos. It works by grabbing 1 second of footage and playing back and forth to make a seemless gif like animation. It’s really easy and can help you images pop. However it’s proprietart and only works on mobile devices.

How it manipulates video is actually really simple and I’ve created it with FFMPEG and a poorly written bash script.

This script comes with NO support, it’s just for fun

Copy this code into a text file. I simply called it loopy

#! /bin/sh

ffmpeg -y -i $1 -t 00:00:01 -ss $2 -c:v ffv1 -an .loop1.mkv
ffmpeg -y -i .loop1.mkv -vf reverse -c:v ffv1 .loop2.mkv
echo "file '.loop1.mkv'" > .list
echo "file '.loop2.mkv'" >> .list
echo "file '.loop1.mkv'" >> .list
echo "file '.loop2.mkv'" >> .list
ffmpeg -f concat -safe 0 -i .list -c copy .render.mkv
ffmpeg -y -i .render.mkv -s 1280x720 -pix_fmt yuv420p -b:v 2M loop.mp4
rm .list .loop1.mkv .loop2.mkv .render.mkv

You need to give it permissions to be executed.

chmod +x loopy

Executing only requires the video file name, and the time code you want the clip from. (HOUR:MINUTE:SECONDS).

./loopy video.mp4 00:00:00

Have fun!