diff --git a/README.md b/README.md new file mode 100644 index 0000000..0ed47f5 --- /dev/null +++ b/README.md @@ -0,0 +1,47 @@ +# slitscan +slitscan is a script inspired by [this Mastodon +post](https://fed.qaz.red/@elithebearded/113070315634312301). It takes a video +file as input and allows you to "transpose" the frames of the video to view +along the height or width axes instead of the "time" axis you normally watch a +video along. + +## Usage +Say you have a video file `foo.mkv`. To transpose along the height axis and save +to `bar.mkv`, run +``` +python slitscan.py foo.mkv bar.mkv --height +``` + +Similarly, to transpose along the width axis, run +``` +python slitscan.py foo.mkv bar.mkv --width +``` + +## Details +### Uh... what does this do? +Check the linked post for another explanation and examples. + +To elaborate, you can think of a video as a 3D array of pixels. Say the axes of +the array are the frame, height, and width, in that order. Then the entry (24, +500, 900) gives you the pixel in the 499th row and 899th column of the 23rd +frame of the video (we're 0-indexed). You can imagine "watching" a video as +just iterating through the frame axis of that array and displaying each 2D +slice. + +This program transposes that 3D array so you're instead iterating over the +height or width axis and displaying *those* 2D slices. For instance, if you +transpose along the height axis, then the first frame of the output video +consists of the top row of pixels of every single frame of the original video. +The second frame is then the second row of every single original frame, and so +on. Instead of viewing each original frame one by one, it's like you're viewing +them all at once, but only one horizontal line of pixels at a time. + +### But why? +The author of that Mastodon post mentioned that he wrote a bash script to do +this that took a *a couple of days* to run for a short clip. I wanted to see if +I could make it faster (and I did - this runs on the order of a few *minutes* +for similarly short clips). It might be possible to make this script even +faster, but I couldn't figure out how without the script using too much memory. + +### Is this even useful? +I would love to find out that it is!