Skip to main content

A tool to extract frames from MP4 videos and remove duplicates

Project description

Video Frame Extraction Tool

This tool allows you to extract frames from video files, with features like deduplication and dynamic frame skipping.

Features

This Video Frame Extraction Tool is designed to optimize your workflow with powerful, customizable features for handling video frame processing. Below are the standout capabilities:

  • Versatile Video Format Support: Work with popular video formats including .mp4 and .mov.
  • Frame Deduplication: Integrates an intelligent algorithm to eliminate similar frames, ensuring each extracted frame is unique. Customize the similarity threshold to fit your needs.
  • Adaptive Frame Skipping: Dynamically skips frames to maintain efficiency without sacrificing quality. The tool automatically adjusts skipping based on the video's FPS and duration, or you can customize the settings to your preferences.
  • Custom Frame Limits: Exercise complete control over your output. Set a cap on the maximum number of frames extracted from each video or across all your video processing tasks.
  • Fast Processing: Leverages the power of multi-core CPUs to speed up frame extraction, enabling parallel processing of video files.
  • User-Friendly GUI: A graphical user interface simplifies file selection and settings adjustments, making it accessible to users of all skill levels.

Requirements

  • Python 3.6+
  • Required Python packages (listed in requirements.txt):
    • opencv-python
    • tqdm
    • loguru
    • imagededup
    • click
    • tkinter

Installation

  1. Clone the repository:

    git clone [https://github.com/yourusername/video-frame-extraction-tool.git](https://github.com/yourusername/video-frame-extraction-tool.git)
    cd video-frame-extraction-tool
    
  2. Install the required Python packages:

    pip install -r requirements.txt
    

Usage:

python extract_frames.py [OPTIONS]

CLI arguments:

Tailor the tool's operation with command-line arguments to fit your project requirements:

  • --threshold FLOAT Set the similarity threshold for deduplication (range: 0.5 to 1.0). A higher value results in stricter deduplication.
  • --no-deduplication Disables the frame deduplication feature.
  • --no-fps-skip Stops the tool from skipping frames based on FPS, extracting every frame.
  • --no-time-skip Prevents frame skipping based on video duration.
  • --max-frames INTEGER Limit the total number of frames to be generated from all processed videos.
  • --max-frames-per-video INTEGER Specify a maximum number of frames to be extracted from each individual video.

Example usage:

python extract_frames.py --threshold 0.95 --max-frames 5000 --max-frames-per-video 1000

This fine-tuned approach provides a robust and flexible solution to efficiently manage frame extraction projects with precision control over output quality and operational parameters.

How It Works

Frame Extraction & Optimization

  • Variable Frame Skipping: Based on the set parameters and video characteristics (FPS and length), the tool calculates an optimal frame skipping strategy to balance between processing speed and output quality.
  • Parallel Processing: Distributes the workload across available CPU cores, significantly reducing the time required for frame extraction.
  • Efficient Frame Saving: Extracted frames are saved as JPG images, with an option to adjust the quality and resolution to meet specific needs.

Deduplication for Quality Control:

  • Utilizes a CNN-based method to analyze and compare frames for near-duplicate detection.
  • Customizable threshold: Allows precision control over what is considered a duplicate, adjustable via the --threshold argument.
  • Organizes and relocates duplicates to a designated folder, ensuring your main output directory contains only unique frames.

Contributing

Contributions are welcome! Please open issues or submit pull requests.

Contact

For questions or feedback, please contact bussines@tadeasfort.com].

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

mp4_to_jpg-1.0.5.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

mp4_to_jpg-1.0.5-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file mp4_to_jpg-1.0.5.tar.gz.

File metadata

  • Download URL: mp4_to_jpg-1.0.5.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.9

File hashes

Hashes for mp4_to_jpg-1.0.5.tar.gz
Algorithm Hash digest
SHA256 9298ba16e9637359eb8203000c6b3377a8438b1c56a59c4403898e1cb3d25dde
MD5 4bf8ad7bb57d81498038a8ab46fcd64f
BLAKE2b-256 456c1f9ff8e4bd0af9a7897683c17413418617736a6fb0e78b1f325bfe0870ea

See more details on using hashes here.

File details

Details for the file mp4_to_jpg-1.0.5-py3-none-any.whl.

File metadata

  • Download URL: mp4_to_jpg-1.0.5-py3-none-any.whl
  • Upload date:
  • Size: 6.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.9

File hashes

Hashes for mp4_to_jpg-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 63d99b4da0be167d8cab956d951c03e9de8c1e5efa1bf357825d0ed8b7668bdc
MD5 0b87f4363e83af81635760166a550687
BLAKE2b-256 1bc0553dc5b9f00d9a32a6b09ad0372fc41d114434638a7d2bfdb2e779a2f724

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