Skip to content

A collection of tools to manipulate video files in a creative way.

Notifications You must be signed in to change notification settings

philintheattic/video-tools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

video-tools

Installation

For Windows

If you don't want to bother with python and all that code you can download the windows executables from the latest release

Python

Copy the script you want to use into the folder that contains the videofile that you want to process. Run the script and follow the prompts. For the script to work you need an installation of ffmpeg that is added to PATH. Depending on the script you may also need:

  • opencv
pip install opencv-python
  • Pillow
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade Pillow
  • NumPy
pip install numpy

Description

I was looking for ways to manipulate videofiles with code to use the output in an artistic way. These tools are a way of learning (to code) and automating processes that would be very time consuming if done in software like After Effects or Fusion. The project is basically just tailored around my needs although I try to keep it as reusable and user-friendly as possible.

The tools

videobreaker

This script takes an input video and compresses it via ffmpeg with a quality setting of -crf 67 which is the worst possible setting in ffmpeg. This generates a highly compressed videofile with lots of compression artifacts. This compressed videofile is then used as a new input file and will be further compressed and so on. The file will get more and more "destroyed" in the process creating lots of interesting (and sometimes creepy) visuals. You can specify the number of iterations.

Example images of the input file, after the first compression, the 10th and the 50th:

input file after first compression after 10th compression after 50th compression

videoslicer

This script takes an input video and slices it up vertically in a number of stripes. Those slices are then shuffled and reassembled back into a new video file. The number of slices can be specified by the user.

Example image, 25 slices:

input video 25 slices

videotunneler

This script takes an input video, scales it down and overlays it on top of itself creating a sort of tunnel effect. You can specify the number of copies and also provide a value for rotation. Rotation happens over time by multiplying the input value with the the t variable in the FFmpeg rotation filter.

Example image of the input file, n=4:no rotation, n=10,rotation=0.01

input video copies:4, no rotation copies:10, rotation:0.01

videoslitscan

A slitscan effect that works by slicing the input video into a lot of horizontal stripes and then offsetting each slice in time. The slices are then reassembled back together.

Example video: Slice width=10

slitscan.mp4

videointerpolater

Uses the FFmpeg filter minterpolate to stretch a video with some sort of optical flow. Inspired by this Blogpost from Antonio Roberts. Best used on a very short clip that contains only single frames of images in quick succesion. If you then use high stretch factor values you get interesting motion interpolation artifacts

Example:

Input file in original speed:

minterpolate_01.mp4

Output file. Stretch factor = 40

minterpolate_out.mp4

videoeraserpolater

Takes an input video and extracts 1 frame per second. The resulting video is then stretched back to its original length with the minterpolate filter applied. The result is a wildly interpolated version of the original clip. A bit hard to describe I guess so here is an example:

Input file:

eraserpolater_demo_in.mp4

Output file:

eraserpolater_demo_out.mp4

video2ascii

Converts any video into ASCII art. This works by first extracting all the frames from the input video and then converting them one by one into ASCII. The code for the ASCII conversion is based upon a youtube tutorial by Raphson. If all images are processed they are concatenated with ffmpeg. You lose the audio in the process but this is no big deal since you can easily just use the audio track from the original clip in your video editor of choice. WARNING: Since every frame needs to be calculated it could take a lot of time depending on the length (and thus frame count) of the input video.

You can also specify the "Level of Detail" (LOD) of the ASCII conversion.

Example:

video2ascii_lod.mp4

videomvextractor

This script uses the ffmpeg codecview filter option that superimposes motion vector data upon the image. The cool thing is that it is coupled with a blend filter that effectively cancels out the original footage so that only the motion vector visualization is visible in the final output.

Example:

mvextractor_demo.mp4

videopixelsort

Works like the video2ascii script but performs a pixel sorting algorithm on the individual frames. The code for the pixel sorting stuff comes from Gregory Johnson. WARNING: Since every frame needs to be calculated it could take a lot of time depending on the length (and thus frame count) of the input video.

Example:

pixelsort_demo.mp4

videocirculator

Uses the ffmpeg geq (generic equation) filter option to bend the pixels around a half-sphere that is mirrored along the horizontal axis. This ffmpeg command was originally used to spice up waveform visualizations (also done with ffmpeg) and bend them around in a circle but can of course be used on any footage with interesting results.

Example:

circulator_demo.mp4

aspectratioswitcher

When the client wants vertical video for reels... This is just a joke. It switches the videos orientation (it flips width with height and vice versa) without preserving the original aspect ratio. The result is a stretched video. A fun idea would be to write a program that automatically rips reels off instagram, flips the aspect ratio and displays the new videos somewhere else. Maybe in an art gallery. (as if there was a satirical commentary on viewing habits in the 21st century hidden in there...)

Example:

aspectratioswitcher_demo.mp4

videotripper

Makes videos "trippy". I tried to learn the opencv library and found out that you can just multiply the values of a pixel array with an arbitrary number and it results in crazy colors. This script takes an input video and a multiplication factor and outputs a new video with multiplied color values resulting in a colorful "trippy" look. The higher the number the more "noisy" it looks. You lose the audio in the process but you can always add it back using the original video in the video editor of your choice. In fact the result works great if you overlay it on top of your original clip and play around with blending modes. As a bonus, this script actually shows a preview of the resulting image while it is encoding so you can quickly check the intensity of the effect and abort (using the Enter key while the preview window is in focus) the process if you need to adjust the value.

Example:

videotripper_demo.mp4

tbp_makeimage

I took the timebased photography script by Hannes Bajohr and modified it so that it only outputs 1 Frame. Check out his github for more information on what timebased photography is and how it works.