| # Video Compressor and Trimmer | |
| [](https://www.python.org/) | |
| [](https://streamlit.io/) | |
| [](https://ffmpeg.org/) | |
| [](LICENSE) | |
| 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: | |
| ```cmd | |
| python -m venv venv | |
| ``` | |
| 4. Activate the virtual environment: | |
| - Windows: | |
| ```cmd | |
| .\venv\Scripts\activate | |
| ``` | |
| - macOS/Linux: | |
| ```bash | |
| source venv/bin/activate | |
| ``` | |
| 5. Install the required dependencies: | |
| ```bash | |
| pip install -r requirements.txt | |
| ``` | |
| ## Usage | |
| 1. Run the Streamlit application: | |
| ```bash | |
| 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](LICENSE) file for details. | |