Turn your daily selfies into a timelapse video
MIT License
Turn your daily selfies into a good-looking timelapse.
This script automatically scales, rotates, crops, and captions all frames so your eyes are aligned in each photo, and compiles these frames into a timelapse.
If you need help with installing or using Facemation, please feel free to start a discussion or contact me directly.
.7z
archive instead.)bin
directory, and copy the file ffmpeg.exe
to thefacemation.exe
and ffmpeg.exe
in the same directory.apt install ffmpeg
.Unfortunately, I don't have macOS, which means that I cannot create an executable for macOS systems. Your best bet is probably to run the Python scripts directly by following the development instructions below, but even then I cannot guarantee it will work. If you have suggestions for how I can solve this, please let me know by opening an issue, starting a discussion, or contacting me directly.
input
directory.facemation
by double-clicking it.output/facemation.mp4
.All intermediate results are heavily cached, so subsequent runs are much faster.
You can change how Facemation behaves by editing the config.py
file.
Below are some examples of how you can configure Facemation.
Check config_default.py
for
a list of all options.
If you do not have FFmpeg, you can disable it. Facemation will still work, but will skip the final step of creating a video.
config = {
"ffmpeg": {
"enabled": False,
}
}
This code assumes that each filename is something like IMG_20230104_174807.jpg
.
from datetime import datetime
config = {
"caption": {
"enabled": True,
"generator": (lambda filename: str(datetime.strptime(filename, "IMG_%Y%m%d_%H%M%S.jpg").date())),
},
}
This code assumes that each filename is something like IMG_20230104_174807.jpg
.
from datetime import datetime
important_date = datetime(year=2023, month=1, day=1).date()
config = {
"caption": {
"enabled": True,
"generator":
(lambda filename: str((datetime.strptime(filename, "IMG_%Y%m%d_%H%M%S.jpg").date() - important_date).days)),
},
}
Put your music file in the directory that contains config.py
.
Then, update your configuration as below;
replace music.mp3
with the name of your music file.
config = {
"ffmpeg": {
"custom_inputs": ["-i", "music.mp3"],
"custom_output_options": ["-map", "0:v", "-map", "1:a", "-shortest"],
},
}
If you are a developer and want to help with or change Facemation, these instructions are for you.
shape_predictor_5_face_landmarks.dat
src/main/python/resources/
)Roboto-Regular.ttf
src/main/python/resources/
)python
.python3
instead if you have not linked python
to python3
.venv
installed by running python -m venv
;venv
.venv
on Debian/Ubuntu, run apt install python3-venv
.dlib
)apt install cmake
.dlib
)apt install g++
.dlib
)dlib
)python -m venv venv/
source venv/bin/activate
./venv/Scripts/activate
python -m pip install --upgrade pip wheel
python -m pip install -r requirements.txt
config_dev.py
to override both config_default.py
and config.py
.
cp src/main/resources/config_empty.py config_dev.py
Note that config_dev.py
is always searched for in the current working directory.source venv/bin/activate
./venv/Scripts/activate
python src/main/python/facemation.py
staticx
C:/Program Files (x86)/Windows Kits/10/Redist/[version]/ucrt/x64
to src/python/resources/
.[version]
in the path differs per system.version
file.config_empty.py
is up-to-date with config_default.py
.dist/
and create .zip
distribution:
./build_linux.sh
./build_windows.ps1
dist/facemation
In chronological order of contribution:
If I should add, remove, or change anything here, just open an issue or email me!