- Extract a specific video frame
- Save frames as PNG
- Display the result in the terminal using
imgcat - Error handling with styled messages
- Argument validation
- Simple command-line interface
- Python 3.8 or newer
- pip (Python package manager)
- Clone the repository or download the project files.
git clone git@github.com:hectorOliSan/get-frame.git- Create a virtual environment:
python -m venv .venv- Activate the virtual environment:
source .venv/bin/activate # Linux/macOS
.venv\Scripts\activate # Windows- Install dependencies:
pip install -r requirements.txtget-frame/
├── output/ # Directory where extracted frames are saved
├── main.py # Main file containing the extractor logic
├── decorators.py # Decorators for error handling and styling
├── requirements.txt # Project dependencies
├── .gitignore
└── README.md
opencv-python: Library for video processing and frame extractionnumpy: Numerical operations and arraysimgcat: Display images in the terminalpillow: Image processingrich: Styles and colors for the terminal
python main.py <video_path> <frame_number><video_path>: Path to the video file from which to extract the frame. Supports common video formats (MP4, AVI, MOV, etc.).<frame_number>: Frame number to extract. Must be greater than 0 and less than or equal to the total number of frames in the video.
python main.py video.mp4 10The extracted frame is saved in the output/ directory, which is created automatically if it does not exist. The output file keeps the same name as the original video, but with the .png extension.
The frame is also displayed directly in the terminal if your terminal supports imgcat.
