π« The Pain Point
Zalo limits video attachments to 25MB. Your phone recorded a 100MB video. You need to compress it without making it unwatchable.
π Agentic Solution
A Smart Video Compressor that targets a specific file size.
Key Features:
- Target Size: Specify βunder 25MBβ and the script calculates optimal bitrate.
- Quality Presets: Fast, Balanced, High Quality.
- Batch Mode: Compress multiple videos at once.
βοΈ Phase 1: Commander (Quick Fix)
For quick compression.
Prompt:
βI have a video
party.mp4(100MB). Write a Python script using FFmpeg to:
- Target Size: Compress to under 25MB.
- Calculate Bitrate: Based on duration and target size.
- Maintain Audio: Keep audio at 128kbps.
- Output: Save as
party_compressed.mp4.Print progress. Handle FFmpeg errors gracefully.β
Result: Shareable video that fits Zaloβs limit.
ποΈ Phase 2: Architect (Permanent Tool)
Engineering Prompt:
**Role:** Python Tool Developer
**Task:** Create a "Video Compressor for Social Media".
**Requirements:**
1. **GUI:**
* Select video or folder.
* Target size input (MB).
* Quality preset dropdown.
* Resolution option (keep/720p/480p).
* Progress bar with ETA.
2. **Logic:**
* Calculate video bitrate: (target_size * 8) / duration - audio_bitrate.
* Two-pass encoding for better quality.
* Fallback to lower resolution if bitrate too low.
3. **Deliverables:**
* `video_compress.py`
* `run.bat`, `run.sh`
* `requirements.txt`
π§ Prompt Decoding
- Two-pass encoding: First pass analyzes the video, second pass optimizes compression. Better quality at same file size.
π οΈ Instructions
- Install FFmpeg.
- Copy Prompt β Run.