😫 Vấn đề (The Pain Point)
Video thì không nhúng vào email được. Bạn cần một file GIF nhẹ, tự chạy (autoplay) để thu hút sự chú ý. Các web convert online thường đóng watermark hoặc giới hạn 5 giây.
🚀 Giải pháp Agentic (The Solution)
Tool convert Video -> GIF với quyền kiểm soát tối đa: cắt đoạn, chỉnh FPS, resize.
Tính năng:
- Trim Video: Chọn thời gian bắt đầu - kết thúc (ví dụ 00:05 đến 00:10).
- Optimize: Giảm FPS hoặc Resize để file GIF nhẹ (< 5MB).
- Text Overlay: (Nâng cao) Viết thêm chữ Meme vào GIF.
🤖 Engineering Prompt (Copy & Paste)
**Role:** Python Media Developer
**Task:** Create a "Video to GIF Converter" with optimization options.
**Requirements:**
1. **Tech Stack:** Python, `tkinter`, `moviepy` (easier wrapper around FFmpeg).
2. **GUI:**
* Select Input Video.
* **Settings:**
* Start Time / End Time (to trim).
* Resize Width (e.g., 500px).
* FPS (default 10-15 for GIF).
* "Convert to GIF" button.
3. **Logic:**
* Use `moviepy.editor.VideoFileClip`.
* Subclip (Trim) -> Resize -> Write GIF.
* **Optimization:** GIF files can get huge. Default formatting should optimize for reasonable size suitable for web/email.
* Show progress (MoviePy has console progress, try to capture it or show "Processing..." spinner).
4. **Deliverables:**
* `gif_converter.py`
* `run.bat`
* `requirements.txt` (`moviepy`)
**Context:** Marketers creating email newsletters need GIFs to demonstrate products.
🧠 Giải mã Prompt
- MoviePy: Thư viện này render GIF rất đẹp (thuật toán tối ưu bảng màu) so với việc dùng OpenCV frame-by-frame.
- FPS Control: GIF không cần 60fps. Giảm xuống 10-15fps giúp giảm dung lượng file đi 4-5 lần.
🛠️ Hướng dẫn
- Copy Prompt -> AI Editor paste.
- Chạy
run.bat. - Chọn Video -> Chỉnh Start/End -> Convert.