Skip to content

LPFerreira33/video_utils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

video_utils

A collection of utilities for video processing, including resizing videos with bitrate and audio quality control, and format conversion using FFmpeg.

Features

  • 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

Requirements

  • Python 3.x
  • OpenCV (cv2)
  • FFmpeg (must be installed and in your system PATH)

Installation

# 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-python

Usage

Resize Video

python video_resize.py input_video.mp4 output_video.mp4 --width 1280 --height 720

With audio quality control:

python video_resize.py input_video.mp4 output_video.mp4 --width 1280 --height 720 --audio-codec aac --audio-bitrate 96

All options:

  • --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)

Convert MKV to MP4

See mkv2mp4.py for MKV to MP4 conversion.

Files

  • video_resize.py — Main script for resizing videos with audio and bitrate options.
  • mkv2mp4.py — Script for converting MKV files to MP4.

Notes

  • Make sure FFmpeg is installed and accessible from your command line.
  • The scripts display a progress bar and estimated time remaining during processing.

License

MIT License

About

A collection of utilities for video processing, including resizing videos with bitrate and audio quality control, and format conversion using FFmpeg.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages