File size: 2,340 Bytes
350f182
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# Video Compressor and Trimmer

[![Python Version](https://img.shields.io/badge/python-3.8%2B-blue.svg)](https://www.python.org/)
[![Streamlit](https://img.shields.io/badge/Streamlit-1.x-red.svg)](https://streamlit.io/)
[![FFmpeg](https://img.shields.io/badge/FFmpeg-6.x-green.svg)](https://ffmpeg.org/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](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.