Fast, privacy-first video duration calculation using a custom MP4 binary parser, browser metadata, and an optional AI fallback.
Fast • Browser-Based • Privacy First • Open Source
Features • Preview • How it Works • Installation • Privacy
| Feature | Description |
|---|---|
| ⚡ Fast MP4 Binary Parser | Reads MP4 metadata directly without decoding the video. |
| 📁 Batch Processing | Process multiple videos with drag & drop support. |
| 🎬 Multi-stage Detection | Binary parser → Browser Metadata → AI Fallback. |
| 📊 Duration Statistics | Calculate total and average duration instantly. |
| 🤖 Optional AI Fallback | Uses Gemini only when local detection fails. |
| 🔒 Privacy First | Files remain on your device whenever possible. |
| 💻 Browser Based | No installation required. |
Most online video duration calculators require uploading videos to a server.
This project processes videos locally whenever possible using a custom MP4 binary parser.
This makes duration detection significantly faster while keeping your videos private.
The application follows a three-stage detection pipeline.
[ Upload Video Files ]
│
▼
┌─────────────────────────┐
│ 1. Binary MP4 Parser │ ──(Success)──► [ Display Results ✅ ]
└─────────────────────────┘
│
(Failed)
│
▼
┌─────────────────────────┐
│ 2. HTML5 Metadata API │ ──(Success)──► [ Display Results ✅ ]
└─────────────────────────┘
│
(Failed)
│
▼
┌─────────────────────────┐
│ 3. Gemini AI Fallback │ ──(Success)──► [ Display Results ✅ ]
└─────────────────────────┘
The majority of MP4 files are processed locally using the custom binary parser, making the application extremely fast while keeping videos on your device.
| Category | Technologies |
|---|---|
| Frontend | React |
| Language | TypeScript |
| Build Tool | Vite |
| Local Processing | HTML5 Video API |
| Binary Parsing | Custom MP4 Parser |
| AI (Optional) | Google Gemini |
src/
│
├── components/
│
├── utils/
│ ├── mp4Parser.ts
│ ├── videoProcessor.ts
│ └── timeFormatter.ts
│
├── types.ts
├── App.tsx
└── main.tsx
Clone the repository
git clone https://github.com/lab1207/Video-Duration-Calculator.gitEnter the project
cd Video-Duration-CalculatorInstall dependencies
npm installCreate a .env file
GEMINI_API_KEY=YOUR_GEMINI_API_KEYGet your free API key from Google AI Studio:
Run the development server
npm run devBuild for production
npm run buildPreview production build
npm run preview| Variable | Required | Description |
|---|---|---|
GEMINI_API_KEY |
Optional | Enables the AI fallback used only when local video duration detection fails. |
This application is designed to process videos locally whenever possible.
Processing order:
- Custom MP4 Binary Parser
- Browser Metadata
- Google Gemini AI (Optional)
If you do not provide a GEMINI_API_KEY, the application will continue working normally for supported video formats. Only the optional AI fallback will be unavailable.
- ✅ Chrome
- ✅ Edge
- ✅ Firefox
- ✅ Safari
- Folder Upload
- Recursive Directory Scanning
- Parallel Processing Queue
- CSV Export
- Excel Export
- JSON Export
- Additional Video Format Support
- Progress Indicators
- Offline Mode (PWA)
- File Search & Filtering
Contributions, issues, and feature requests are welcome.
Feel free to open an issue or submit a pull request.
This project is licensed under the MIT License.
