Optimizing a Media Archive on Windows: BAT Script with Gemini, ChatGPT, and Qwen
A family photo and video archive spanning 15 years takes up hundreds of gigabytes across dozens of folders. Formats range from high-bitrate footage from mirrorless cameras to HEIC files from smartphones. Solution: a BAT script using pure CMD, running on any Windows machine without needing Python or Node.js. It leverages FFmpeg for videos and ImageMagick for HEIC, installing the tools automatically via winget.
The development process unfolded in chats with AI models: I acted as a manager with technical expertise, avoiding any manual coding. We iteratively fixed bugs by pinpointing problematic sections to minimize hallucinations.
Comparison of AI Models in Development
Google Gemini 3
Produced a minimum viable product (MVP) of 500 lines in a single evening. Core logic: recursive traversal and conversion with strict parameters. Handled dozens of gigabytes overnight. Issues cropped up when adding complexity:
- CLI support, drag-and-drop, Cyrillic paths, and long file paths.
- Hallucinations: logic breakdowns, code truncation, and regressions in prior fixes.
ChatGPT 5.2
Handled refactoring and bug fixes. Quick responses that anticipated requirements. Limitations: daily token limits and similar hallucinations after 1–2 iterations. Stronger for Linux scripts, weaker on Windows.
Qwen 3-Max (Alibaba)
It devoured the entire codebase, dissected the logic, and added detailed comments. Delivered a full refactor: menu system, CLI arguments, and error fixes. The script ballooned to 1000 lines and runs reliably. Hallucinations kicked in when adding ETA and validation checks—hitting the model's limits.
Functionality of the Ready Script
The Media Optimizer script automates optimization:
- Auto-install: FFmpeg and ImageMagick via winget if they're missing.
- Launch modes:
1. Drag & drop a folder.
2. CLI for scheduling or pipelines.
- Processing:
- Recursive traversal of any depth.
- Mirrors folder structure while copying non-media files.
- Video: H.264/H.265 via NVIDIA NVENC (auto-detects GPU).
- Photos: resize and compression with no visible quality loss.
- Safeguards against overwriting existing files.
Results of Archive Optimization
Processed a 15-year archive over two nights:
- Volume reduced by 3+ times.
- Old videos: up to 10x.
- Modern photos/videos: 2–4x.
- Quality: visually identical on 2K monitors.
Example: Lake Baikal photo 4608x3456 (6.4 MB) → 4320x3240 (1.9 MB).
Compared to Picture Resizer 6.0: the script handles HEIC better, preserves folder structure, and taps into modern FFmpeg algorithms.
What’s Important
- BAT script runs on any Windows without prerequisites.
- AI accelerated development but demands iterative bug oversight.
- Qwen excels at refactoring complex Windows code.
- Media compression: 3–10x without quality loss using NVENC and FFmpeg.
- Ideal for deeply nested archives with Cyrillic paths.
— Editorial Team
No comments yet.