Playback is a Python-based gesture recognition system that allows you to control media playback using hand gestures captured through your webcam. It uses computer vision and hand tracking to provide a touchless media control experience.
- Real-time hand gesture detection
- Media playback control through hand movements
- Clean, modular, and type-safe Python implementation
- Configurable gesture thresholds and settings
Gesture | Action | Description |
---|---|---|
Pinch | Play/Pause | Bring thumb and index finger together |
Left Hand | Rewind | Move hand to the left side of the frame |
Right Hand | Forward | Move hand to the right side of the frame |
- Python 3.7+
- Webcam
- Clone the repository:
git clone https://github.com/Shobhit-Nagpal/playback.git
cd playback
- Install required packages:
pip install opencv-python mediapipe pyautogui numpy
Run the main script:
python play.py
To exit the application, press 'q' while the window is in focus.
The application uses two configuration classes that can be customized:
@dataclass
class GestureConfig:
pinch_threshold: float = 0.1 # Sensitivity for pinch detection
left_threshold: float = 0.3 # Left boundary for rewind gesture
right_threshold: float = 0.7 # Right boundary for forward gesture
cooldown: int = 10 # Frames to wait between gestures
@dataclass
class MediaConfig:
frame_width: int = 600 # Width of camera frame
frame_height: int = 800 # Height of camera frame
window_name: str = "HandFlix" # Window title
handflix/
│
├── play.py # Main application file
├── README.md # This file
The project is organized into three main classes:
GestureController
: Handles gesture recognition using MediaPipeMediaController
: Manages media control actionsPlayback
: Main application class that coordinates everything
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
- Webcam not detected: Ensure your webcam is properly connected and not being used by another application.
- MediaPipe installation: If you encounter issues installing MediaPipe, try:
pip install --upgrade pip pip install mediapipe
- Gesture sensitivity: Adjust the thresholds in
GestureConfig
if gestures are too sensitive or not sensitive enough.