I sent my thesis for the final review so I had some time to work on something different. As couple days ago I checked with my girlfriend some videos from our trip to Paris and I found one particular video that made me thinking "Damn that was trippy"
But I decided to make it even more trippy. As I like bash I wanted to make a simple script that will convert movie clip to more crazy version of it
Let’s first see what is a trippy image.
To generate images bellow I used disperse filter
From documentation of the filter you can read that:
( s ) Spread - spread distance of dispersion
( d ) Density - density or frequency of detail
( c ) Curviness - curviness/clumpiness of dispersion
As you can see first four images look distorted but what I was looking for is the effect made by last two of them
I tried to make it look more like the Fear and loathing in Las Vegas movie poster.
I’m hitting in more curvy transformations and generally smooth lines
If you would like to run this script keep in mind that on my machine with parallel instances of disperse it took 17 minutes to calculate all 344 images
Processing videos
Before I started making script I checked different approaches. First I checked some python libraries which had similar disperse implementation. In the end I didn’t choose them as I have no idea how to write multithreaded code in python and I discovered that there are other solutions. I could write small scripts in python and still use parallel but if it’s possible to use bash I just decided to make everything in it
In the end I made a script that with every 50 frames increases spread parameter for disperse so it looks like with time movie gets more circular shape distortion
To use it you have to type bash parser.sh -r -m '/path/to/video/to/convert' -o output_file.mp4 or
bash parser.sh -r -s -m '/path/to/video/to/convert' -o output_file.mp4 with -s flag which will
run disperse program in serial
Output results
On the bottom you can see two videos side by side. The one on the right was transformed by disperse filter
When it comes to time of execution the parallel version was faster:
So parallel one took 8 min and serial one 10 min
Final notes
I hope you had fun reading/watching this. In conclusion I have some points that I would like to share:
Working with ffmpeg tool in command line is really easy. If you have bunch of images and want to make a movie from them I would say this is one of the easiest options to pick.
parallel can speed up computation but it’s not always easy to estimate if parallel processing will have great speed improvements