Set of tools for transferring optical flow from one media to another.
This tool extracts optical flow as a dense velocity field from a video input (file or stream) and applies it to an image, a video file or stream, for creative purposes. Multiple techniques can be used, various parameters can be tuned to precisely craft visual effects directly from raw raster data. Here is how it looks (click to view in full resolution):
Flow Source | Pixmap Source | Result |
---|---|---|
![]() |
![]() |
![]() |
You'll need a working installation of Python 3. You'll also need FFmpeg binaries, available in PATH
, the ffmpeg -version
command should work.
The process should be straightforward.
- Download the latest release
- Install it with
pip
:pip install ~/Downloads/transflow-1.11.0.tar.gz
If you want to access the code.
- Clone or download this repository:
git clone https://github.com/ychalier/transflow.git cd transflow
- Install requirements:
pip install -r requirements.txt
The alias transflow
represents either python -m transflow
or python transflow.py
, depending on the chosen installation method.
The simplest process consists in taking the motion from a video file and applying it to an image:
transflow flow.mp4 -p image.jpg -o output.mp4
If your are not too familiar with the command line, you can use the graphical user interface (GUI) to set parameters interactively. You can run the GUI with:
transflow gui
For more details, see USAGE.md.
transflow assets/River.mp4 -p assets/Deer.jpg -Oo out/ExampleBasic.mp4
transflow assets/River.mp4 -d forward -p assets/Frame.png -r random 0.5 -m assets/Mask.png -Oo out/ExampleResetRandom.mp4
transflow assets/Train.mp4 -p assets/Train.mp4 -i border-right:1 -l 0 introduction --background black -Oo out/ExampleIntroduction.mp4"
transflow assets/Train.mp4 -p assets/Train.mp4 -p assets/Frame.png 1 -l 0 static -l1 -e -Oo out/ExampleStickyTexture.mp4
This repository also contains two other versions of this program:
- in the extra/cpp folder, a C++ version using OpenCV to transfer the flow from one webcam to another,
- in the extra/www folder, a WebGL version that emulates the effect in a web browser; a version is hosted on chalier.fr/transflow.
There are also other modules (in the extra folder):
- viewflow, for visualizing and inspecting optical flow in a video player setting,
- control, for generating alteration images (see Pixmap Alteration).
Contributions are welcomed. Do not hesitate to submit a pull request with your changes! Submit bug reports and feature suggestions in the issue tracker.
This project is licensed under the GPL-3.0 license.