Skip to main content

Time-lapse movie assembly

Project description

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, filters=None)
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()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

time_lapse-5.0.tar.gz (2.4 MB view details)

Uploaded Source

Built Distribution

time_lapse-5.0-py3-none-any.whl (52.9 kB view details)

Uploaded Python 3

File details

Details for the file time_lapse-5.0.tar.gz.

File metadata

  • Download URL: time_lapse-5.0.tar.gz
  • Upload date:
  • Size: 2.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.31.0

File hashes

Hashes for time_lapse-5.0.tar.gz
Algorithm Hash digest
SHA256 c772957c72fef1c454561c9118d1a476c5d9b2c5c936dbc1a58fd1563a9e593c
MD5 d625d982e01a53378c832bce87b059d4
BLAKE2b-256 37e8d8e69c33e5d49aed9672071d9b547ecc88bfc312d3561dec9922a8d51f6c

See more details on using hashes here.

File details

Details for the file time_lapse-5.0-py3-none-any.whl.

File metadata

  • Download URL: time_lapse-5.0-py3-none-any.whl
  • Upload date:
  • Size: 52.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.31.0

File hashes

Hashes for time_lapse-5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e9c19585de348e67b2d3b5790ce33d05d4b4cae83d96d80eb62497b26670a667
MD5 d6e8803b4df46bc96a6e599c3f29fc69
BLAKE2b-256 dd270468834aef8e0c89b9e934aa1e4d6cabfeacf7b32926d7cd5c74204f8aaa

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page