Skip to main content

Time-Lapse assembling

PyPI License Build

This repo contains tools used to compile Time-lapse movies using ffmpeg. The ffmpeg utility is controlled via the ffmpeg-python wrapper.

Example usage of this package can be found in the time-lapse scripts repository.

Installation

This package requires the ffmpeg tool to be installed.

brew install ffmpeg

Then install this package:

pip install time-lapse

Additionally, when using the verbose output option a graph will be rendered using graphviz, this requires the Graphviz library and the related Python package:

brew install graphviz
pip install time-lapse[graph]

Codec

For near-universal compatibility the H.264 codec is used. The following section describe some of the choices for specific configuration options.

See the ffmpeg wiki for additional information: https://trac.ffmpeg.org/wiki/Encode/H.264

Constant Rate Factor

This uses -crf 20 to set a constant rate factor, which means the overall quality of the movie should be constant. So bitrate varies to ensure this. Higher value is lower quality. The quality and bit rates at this value seem reasonable.

Preset

-preset slower is used to improve the compression ratio for the selected quality (crf), without taking too much time.

Faststart

-movflags +faststart is used to allow the movie to quickly start playing, while it is still loading or buffering.

Quicktime support

The codec defaults to YUV 444, which is not supported by Quicktime. So add pix_fmt yuv420p to fix Quicktime support.

Input

Select input frames

Use frames as input by giving a glob pattern which matches the desired images. Usually these will be tiff images so use -pattern_type glob -i "*.tiff".

Framerate

When using image sequences as input the framerate of the desired output should be given using -framerate 30.

Filters

Commonly used filters:

Steps

  • First deflicker the video to ensure it is equally deflickered for all outputs
  • Then scale and crop the videos to fit the desired final resolutions
  • Then add the watermark (which should not be deflickered)

Scale video

Add scaling to ensure it fits in given dimensions. Negative values for width or height make the encoder figure out the size by itself, keeping the aspect ratio of the source. The integer of the negative value, i.e. 4 for -4, means that the size should be devisble by that value. TODO: does it just scale/squish the video or crop?:

-vf scale=1920:-2
-vf scale=960:540:aspect..

Convert movie

Using time-lapse to find tif files, and create a movie called 'test_movie' with 24 fps and deflickered:

from time_lapse import output, source

source_input = source.get_input(['*.tif'], fps=24, deflicker=10)
output.create_outputs(source_input, 'test_movie', verbose=False)

Inspection

By passing verbose=True to create outputs the following ffmpeg-python inspection methods will be performed.

Show the ffmpeg command options ffmpeg-python would use:

.get_args()

By using graphviz the graph from input to output can be shown using:

.view()

Metadata

Release files for time-lapse 3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for time-lapse 3
File Size Uploaded
time-lapse-3.tar.gz 52.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for time-lapse 3
File Interpreter ABI Platform
time_lapse-3-py3-none-any.whl Python 3 none any Details

Total release size: 61.1 kB

Release files / time-lapse-3.tar.gz

Download URL time-lapse-3.tar.gz
Size 52.4 kB
Tags Source
SHA-256 checksum
How to use checksums
00e6ed2929f51c62541cb95413afb0b3bcbc83e3e859291722f591a7301309cd
BLAKE2b-256 checksum
How to use checksums
4840ed0a070af91b673da13c03faae8f93eb2ae0b0e369167b27a727903e6fe9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.0

Release files / time_lapse-3-py3-none-any.whl

Download URL time_lapse-3-py3-none-any.whl
Size 8.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ae4b373e98b90bdfc31afad94820ddf5c399ce22177a0c953f7c7810c65e3051
BLAKE2b-256 checksum
How to use checksums
0f64bfcf71fcf87917a170fccd00a86f0670f665a67f97eae18ae517b130a6ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.0

Release history Release notifications | RSS feed

9.0

2 release files

8.0

2 release files

7.0

2 release files

6.0

2 release files

5.0

2 release files

4.0

2 release files

This release

3 This release

2 release files

2

2 release files

1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page