Tilt-shift video using Bash
I like to play with tilt-shift videos every once in a while, and usually it needs very complex tools to make. So this time I decided to use the simplest tool ever: a Bash script.
You can see the final result here. Continue reading to know how I did it:
Oh, by the way, this is a very nerdy way of doing it. Not a 1-2-3 method. I did this while bored, but didn’t worry about details. Sorry.
Honestly, I’m using a series of pictures to create a video. In this case I used the Time Lapse application on my Nokia N900. I took a total of 644 shots, one every second.
The Time Lapse application creates a series of files named FileX.jpg, where X is a number from 0 to the number of pics you have taken. So if you want to use the same script, but did not use the same application to take the pictures, you need to edit the script to suit your file naming (or rename your files).
The tilt-shift effect is actually a blur mask applied to all of the pictures, like this:
So if you want to use the same script, but you want to blur a different position on the picture, you need to edit line 12, and modify the parameters for “sparse-color“. Of course there are a number of other options you can change, so you might want to read the docs to understand.
After the script finishes processing all of the pictures, it will then finally compose all of them together to form the video.
Well, I hope this is somewhat useful for anyone.
If you have any hints, please share on the comments.