trim-vid / README.md
algorembrant's picture
Upload 9 files
350f182 verified

Video Compressor and Trimmer

Python Version Streamlit FFmpeg License: MIT

A pure Python web application for compressing and trimming videos with high accuracy. The application uses 2-pass encoding to ensure the output file size matches the target size specified by the user.

Features

  • Video Trimming: Specify start and end times for the output.
  • Custom Resolution: Choose from 1080p, 720p, 480p, 360p, or keep original.
  • Frame Rate Control: Adjust FPS to further reduce file size.
  • Exact Target Size: Specify the output size in MB.
  • History Tracking: Keep a local record of all compression tasks in a SQLite database.

Prerequisites

  • Python 3.8 or higher.
  • FFmpeg must be installed on your system and added to your PATH.
    • Windows: winget install ffmpeg
    • macOS: brew install ffmpeg
    • Linux: sudo apt install ffmpeg

Installation

  1. Clone the repository or download the source code.
  2. Navigate to the project directory.
  3. Create a virtual environment:
    python -m venv venv
    
  4. Activate the virtual environment:
    • Windows:
      .\venv\Scripts\activate
      
    • macOS/Linux:
      source venv/bin/activate
      
  5. Install the required dependencies:
    pip install -r requirements.txt
    

Usage

  1. Run the Streamlit application:
    streamlit run app.py
    
  2. Open the URL provided in your terminal (usually http://localhost:8501).
  3. Upload a video file (MP4, MOV, AVI, MKV).
  4. Configure your compression settings in the sidebar or main panel:
    • Set start and end times for trimming.
    • Select desired resolution and FPS.
    • Enter the target output size in MB.
  5. Click the "Compress & Export" button.
  6. Once processing is complete, download your compressed video.
  7. Check the "History" tab to view past compression details.

License

This project is licensed under the MIT License - see the LICENSE file for details.