A collection of utilities for video processing, including resizing videos with bitrate and audio quality control, and format conversion using FFmpeg.
- Change video resolution with customizable width and height
- Control video bitrate and audio quality (codec, bitrate, channels, sample rate)
- Progress bar with ETA during processing
- Automatic bitrate estimation if not specified
- Format conversion (e.g., MKV to MP4)
- Requires FFmpeg installed and available in your system PATH
- Python 3.x
- OpenCV (
cv2) - FFmpeg (must be installed and in your system PATH)
# Clone the repository
git clone https://github.com/lpferreira33/video_utils.git
cd video_utils
# Create and activate .venv
python -m venv .venv
.venv\Scripts\activate.ps1
pip install opencv-pythonpython video_resize.py input_video.mp4 output_video.mp4 --width 1280 --height 720python video_resize.py input_video.mp4 output_video.mp4 --width 1280 --height 720 --audio-codec aac --audio-bitrate 96--width: Target width (pixels, required)--height: Target height (pixels, required)--bitrate: Target video bitrate in kbps (optional)--audio-codec: Audio codec (e.g., aac, mp3, opus)--audio-bitrate: Audio bitrate in kbps (e.g., 128, 192, 256)--audio-channels: Number of audio channels (e.g., 1 for mono, 2 for stereo)--audio-sample-rate: Audio sample rate in Hz (e.g., 44100, 48000)
See mkv2mp4.py for MKV to MP4 conversion.
video_resize.py— Main script for resizing videos with audio and bitrate options.mkv2mp4.py— Script for converting MKV files to MP4.
- Make sure FFmpeg is installed and accessible from your command line.
- The scripts display a progress bar and estimated time remaining during processing.
MIT License