Skip to main content

A command-line tool to extract high-quality frames from videos.

Project description

Pixtract

Pixtract is a powerful and efficient command-line tool designed to extract high-quality frames from videos. It streamlines the process of obtaining sharp, non-duplicate images from your video files, making it ideal for computer vision datasets, video analysis, or simply capturing the best moments from your recordings.

Features

  • High-Quality Frame Extraction: Extracts frames from a variety of video formats (MP4, MOV, AVI, MKV).
  • Blur Detection: Automatically analyzes and discards blurry frames, ensuring you only get sharp, clear images.
  • Duplicate Frame Removal: Efficiently identifies and removes duplicate or near-duplicate frames based on a configurable threshold, saving you time and disk space.
  • Image Rotation: Corrects the orientation of frames with adjustable rotation.
  • Batch Processing: Process multiple videos in a single run, from a given directory.
  • Dry Run Mode: Simulate the process without creating or deleting any files.
  • Verbose Output: Get detailed logging information for debugging or deeper insights.

Installation

You can install Pixtract directly from GitHub using Git:

pip install git+https://github.com/rahaaatul/Pixtract.git

or from PyPI using pip:

pip install pixtract

Or with pipx for isolated installation:

pipx install pixtract

Usage

To use Pixtract, simply run the pixtract command with the path to your video file or a directory containing videos.

Basic Usage

Process a single video and save frames to a default output folder:

pixtract "path/to/your/video.mp4"

Process all videos in a directory and save frames to a specified output folder:

pixtract "path/to/your/videos_directory" -o "path/to/your/output_folder"

Examples

Extract frames from my_movie.mp4, remove blurry frames (sharpness threshold 50), and remove duplicates (threshold 0.98):

pixtract my_movie.mp4 -s 50 -d 0.98

Process videos in my_videos/, rotate frames by 90 degrees, and enable verbose output:

pixtract my_videos/ -r 90 -v

Simulate processing holiday_clip.mp4 without actually saving or deleting files:

pixtract holiday_clip.mp4 --dry-run

Command-Line Options

Option Short Type Default Description
--input-path str Current Dir Path to a video file or a directory containing videos.
--output -o str Processed_Frames Path to the output directory.
--sharpness -s int 100 Set the sharpness threshold for blur detection. Lower values are more permissive.
--duplicate -d float 1 Set the threshold for duplicate detection. Higher values are more strict.
--rotate -r int 0 Rotate frames by 0, 90, 180, or 270 degrees.
--dry-run flag False Simulate the process without creating or deleting files.
--limit -l int None Limit the number of videos to process.
--verbose -v flag False Enable verbose (debug) output.

Development

To set up the project for development, clone the repository and install the development dependencies:

git clone https://github.com/rahaaatul/pixtract.git
cd pixtract
pip install -e .[dev]

Running Tests

To run the test suite, ensure you have installed the development dependencies and then execute pytest:

pip install -e .[dev]
pytest

Contributing

Contributions are welcome! Please feel free to open an issue or submit a pull request. For bug reports, please use the Bug Report template. For new features, use the Feature Request template.

License

This project is licensed under the MIT License. See the LICENSE file for details.

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

pixtract-0.1.0.tar.gz (12.5 kB view details)

Uploaded Source

Built Distribution

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

pixtract-0.1.0-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

Details for the file pixtract-0.1.0.tar.gz.

File metadata

  • Download URL: pixtract-0.1.0.tar.gz
  • Upload date:
  • Size: 12.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for pixtract-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b8eb305e8213f4ceb5cbb6ca63808da82453523d7132ff83712daed53b75a4ba
MD5 3c865ae9738a154a99d82f2002971ae3
BLAKE2b-256 e858189bc8ea3c5d681f4370f0ecb94a383a4c7163c12ac0a9f726e6ef814b3f

See more details on using hashes here.

Provenance

The following attestation bundles were made for pixtract-0.1.0.tar.gz:

Publisher: publish.yml on rahaaatul/Pixtract

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pixtract-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pixtract-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for pixtract-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fd3dec918f5347b9971ddfe7c5fb099157878f8cfe2575b09404329efc941c4a
MD5 776645f80effb716aec79914c9de3106
BLAKE2b-256 1856eb816c7bc64bca4077e756ddd842ad70943eeee2d9f58fefcf342f8dbeb2

See more details on using hashes here.

Provenance

The following attestation bundles were made for pixtract-0.1.0-py3-none-any.whl:

Publisher: publish.yml on rahaaatul/Pixtract

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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