A unified Python tool for video and image processing, combining video frame extraction, AI-powered image upscaling, and WebP to PNG conversion.
- Video Frame Extraction: Extract frames from video files at specified intervals
- Image Upscaling: Upscale images using ONNX AI models (2x, 2.25x, 4x scaling)
- WebP to PNG Conversion: Convert WebP images to PNG format
- Clone the repository:
git clone https://github.com/ebowwa/media-processor.git
cd media-processor
- Install dependencies:
pip install -r requirements.txt
The tool provides a unified CLI interface for all operations:
Extract frames from a video file:
python cli.py video2frames input_video.mp4 -o output_frames/
Extract frames from all videos in a directory:
python cli.py video2frames videos_directory/ -o frames_output/
Options:
-r, --rate
: Frame extraction rate in seconds (default: 1 second)--keep-video
: Keep original video files after extraction
Upscale a single image:
python cli.py upscale image.png -o upscaled_image.png
Upscale all images in a directory:
python cli.py upscale images_folder/ -o upscaled_folder/
Options:
-m, --model
: Choose upscaling modelmodelx2
: 2x upscaling (default)modelx2_25_JXL
: 2.25x upscalingmodelx4
: 4x upscalingminecraft_modelx4
: 4x upscaling optimized for pixel art
Convert a single WebP image:
python cli.py webp2png image.webp -o image.png
Convert all WebP images in a directory:
python cli.py webp2png webp_folder/ -o png_folder/
- Extract frames from a video every 2 seconds:
python cli.py video2frames movie.mp4 -r 2 -o movie_frames/
- Upscale an image by 4x:
python cli.py upscale photo.jpg -m modelx4 -o photo_4x.jpg
- Batch convert WebP images:
python cli.py webp2png downloads/ -o converted_pngs/
- Video formats: MP4, AVI, MOV, MKV
- Image formats: PNG, JPG, JPEG, BMP, TIFF (for upscaling)
- Conversion: WebP to PNG
- Python 3.7+
- OpenCV (cv2)
- NumPy
- Pillow (PIL)
- ONNX Runtime
media-processor/
├── cli.py # Main CLI interface
├── requirements.txt # Python dependencies
├── models/ # AI upscaling models
│ ├── modelx2.ort
│ ├── modelx2_25_JXL.ort
│ ├── modelx4.ort
│ └── minecraft_modelx4.ort
├── src/
│ ├── video/
│ │ └── extractor.py # Video frame extraction
│ ├── image/
│ │ └── upscaler.py # Image upscaling
│ └── converters/
│ └── webp_converter.py # WebP to PNG conversion
└── examples/ # Example files
This project consolidates functionality from:
- Video2Img
- upscale_img
- webp2png
Please refer to the original repositories for specific licensing information.