A Python package for robust lip frame extraction from videos using MediaPipe, featuring enhanced stability, configurable options, and customizable GPU-accelerated lossless video format conversion for VSR tasks.
Project description
PyLipExtractor
PyLipExtractor is a powerful and easy-to-use Python package for extracting lip regions from videos. It leverages the high-precision MediaPipe Face Mesh to accurately detect and crop the lip area, providing a stable and reliable tool for researchers and developers working on lip-reading, facial analysis, and other related fields.
For detailed information about the package, its features, and how to use them, please refer to the Full Documentation.
Key Features
- Accurate & Stable Lip Detection: Utilizes MediaPipe Face Mesh for precise landmark detection.
- Temporal Smoothing: Applies an Exponential Moving Average (EMA) filter for smooth and consistent lip crops.
- Illumination Normalization: Includes an optional histogram matching filter to normalize video brightness.
- Flexible Configuration: Offers a wide range of customizable settings.
- Customizable Hardware Acceleration: Choose your preferred processing device (
auto,cuda, orcpu) for video conversion. The package leverages NVIDIA GPU acceleration (if available) for faster processing and uses lossless compression to ensure no quality is lost.
Demo
https://github.com/user-attachments/assets/a6841309-3e4d-4b7e-bd0f-b56a5cab28e4
Original video by Tima Miroshnichenko
Installation
pip install pylipextractor
Quick Start
Here is a basic example of how to use PyLipExtractor. For a more detailed and comprehensive example, please see examples/example_usage.py.
from pylipextractor.lip_extractor import LipExtractor
# Create a LipExtractor instance
extractor = LipExtractor()
# Specify the path to your video
video_path = "path/to/your/video.mp4"
output_path = "output/lip_frames.npy"
# Extract the lip frames
extracted_frames, rtf_value = extractor.extract_lip_frames(video_path, output_path)
if extracted_frames is not None:
print(f"Successfully extracted {len(extracted_frames)} frames.")
if rtf_value is not None:
print(f"Real-Time Factor (RTF): {rtf_value:.4f}")
Documentation
For a deep dive into all the features, configurations, and technical details, please read our Comprehensive Documentation.
Contributing
Contributions are welcome! Please see our Contributing Guidelines for more details.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pylipextractor-2.2.4.tar.gz.
File metadata
- Download URL: pylipextractor-2.2.4.tar.gz
- Upload date:
- Size: 15.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ea87d9e12aa4566788647f8c3414754dd0094e444fc9aa0485ce501e3fb87515
|
|
| MD5 |
a11bf3817d8ff3f496a889ebce0fd6f7
|
|
| BLAKE2b-256 |
680201c835318d8c08a74ff02c79382f633f387ed106eab2be252b99329cd0ff
|
File details
Details for the file pylipextractor-2.2.4-py3-none-any.whl.
File metadata
- Download URL: pylipextractor-2.2.4-py3-none-any.whl
- Upload date:
- Size: 15.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4699356d6ce73f671e4bbe31db64bbb6a03e8c0d553113fc574c1e540b9cceba
|
|
| MD5 |
6b393425df3b490fc4541c22c73d1324
|
|
| BLAKE2b-256 |
a8b849fadc29f79753944e055817515ab5e4b056282e1c2134bf5a263a54e3d6
|