Skip to main content

It concatenates a directory with jpegs into a video via FFmpeg.

Project description

# Catframes

[![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/georgy7/catframes.svg)](#)
[![License: CC0-1.0](https://img.shields.io/badge/License-CC0%201.0-lightgrey.svg)](http://creativecommons.org/publicdomain/zero/1.0/)
[![Python versions: 3.3 and above](https://img.shields.io/pypi/pyversions/catframes.svg?style=flat)](#)
[![PyPI](https://img.shields.io/pypi/v/catframes.svg)](https://pypi.org/project/catframes/)

## Features

### 1. Fixing unstable frame size

Some software for some reason may save a part of frames with negligible cropping (about 8 pixels).

![Feature 1, cropping](/ReadMe%20images/case1_1.png)

![Feature 1, extending](/ReadMe%20images/case1_2.png)

Even if this is not your case (it scales the image, for instance),
if a resolution was changed to very close one,
it's still better to use cropping/extending on video, than scaling, to prevent further quality loss.

The script `catframes_fix_resolution` aligns the frames to the left-top corner.

### 2. Fixing the case, one changes camera settings during a day

A video file has a static resolution, but a camera resolution may be changed.
If the change is small, this case will be indistinguishable from the previous one.
But the considerable changes can be processed another way.

#### A change to approximately the same aspect ratio

![Feature 2.1](/ReadMe%20images/case2_1.png)

#### A change to a very different aspect ratio

![Feature 2.2](/ReadMe%20images/case2_2.png)

## Requirements

1. Python 3
2. ImageMagick
3. FFmpeg

## Installation

On Unix-like systems:

```
sudo python3 -m pip install --prefix /usr/local --force-reinstall catframes
```

## Usage

All these scripts scan JPEG and PNG files in a folder based on the file name extensions, *not* [their signatures](https://en.wikipedia.org/wiki/List_of_file_signatures).

1. `catframes_fix_resolution` ensures, that all images in the current directory have the same resolution.
1. Finds out, what resolution is most common in this directory.
1. Renames corrupted images to `{original_filename}_corrupted`.
2. Converts all the pictures **in place** to this resolution.
2. `catframes_to_video [--delete-images] [-o pathToFile.mp4]` compresses them all
to a single video file with 1 frame per second.
Please, use `catframes_to_video [--help]` for more information.

You can also use Catframes to detect common resolution in a folder.

```
$ catframes_most_common_image_resolution_in_the_folder [--statistics|-s]

1280x720 => 3
800x800 => 2
-------------
Completed in 0.023589134216308594 seconds.
```

```
$ var1=`catframes_most_common_image_resolution_in_the_folder`
$ echo $var1
1280x720
```

But this script renames corrupted images as well.

## Disclaimer

*I make no representations or
warranties of any kind concerning the software, express, implied,
statutory or otherwise, including without limitation warranties of
title, merchantability, fitness for a particular purpose, non
infringement, or the absence of latent or other defects, accuracy, or
the present or absence of errors, whether or not discoverable, all to
the greatest extent permissible under applicable law.*


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

catframes-0.2.9.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

catframes-0.2.9-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

Details for the file catframes-0.2.9.tar.gz.

File metadata

  • Download URL: catframes-0.2.9.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7rc1

File hashes

Hashes for catframes-0.2.9.tar.gz
Algorithm Hash digest
SHA256 8ffdcb751eeefb03058ed82742e312b0db05756b3e02c0c3009a1c9913b145a3
MD5 a7a6e5968547e8480c0e1617172497ec
BLAKE2b-256 3a114b7a42e7fa8325d821624c1d72469ea691fb3e7131331578ef4eb3802811

See more details on using hashes here.

File details

Details for the file catframes-0.2.9-py3-none-any.whl.

File metadata

  • Download URL: catframes-0.2.9-py3-none-any.whl
  • Upload date:
  • Size: 10.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7rc1

File hashes

Hashes for catframes-0.2.9-py3-none-any.whl
Algorithm Hash digest
SHA256 14a32ad1366c6bb84df2f91ad1aecc0ab9b8364371cd9b67b9a89db97215f702
MD5 210f2014d2f7747f64db76ed0c1eddb8
BLAKE2b-256 744615b2460e5783e954c730fb99df2fa54cc9126b9434064e39eac9265c2506

See more details on using hashes here.

Supported by

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