Download the PHP package tonymans33/video-optimizer without Composer
On this page you can find all versions of the php package tonymans33/video-optimizer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download tonymans33/video-optimizer
More information about tonymans33/video-optimizer
Files in tonymans33/video-optimizer
Package video-optimizer
Short Description Optimize your Filament videos before they reach your database.
License MIT
Homepage https://github.com/tonymans33/video-optimizer
Informations about the package video-optimizer
Video Optimizer for Filament
Automatically optimize and convert videos uploaded through Filament forms using FFmpeg. Reduce file sizes and standardize formats without any manual intervention.
Results
See the dramatic file size reduction:
Before Optimization
Original MP4: 17.8 MB
After Optimization
Optimized WebM: 679 KB (96% reduction!)
🎯 Result: Same video quality, 96% smaller file size - from 17.8 MB down to just 679 KB!
Features
- 🎬 Automatic video optimization during upload
- 🔄 Format conversion (WebM, MP4)
- ⚡ Configurable quality levels (low, medium, high)
- 📦 Works with standard FileUpload and Spatie Media Library
- 🔌 Filament v3 & v4 compatible
- 🛡️ Graceful fallback if optimization fails
Requirements
- PHP 8.1+
- Laravel 10.0+
- Filament 3.0+ or 4.0+
- FFmpeg installed on your server
Installing FFmpeg
Installation
Install the package via Composer:
Publish the configuration file (optional):
Usage
Basic Usage
Replace Filament's FileUpload with VideoOptimizer:
With Spatie Media Library
For projects using Spatie Media Library:
Using the Facade
Configuration
Set global defaults in config/video-optimizer.php:
Component-level settings override these defaults.
Optimization Levels
| Level | CRF | File Size | Quality | Use Case |
|---|---|---|---|---|
low |
36 | Smallest | Lower | Web previews, thumbnails |
medium |
28 | Balanced | Good | Recommended for most use cases |
high |
20 | Larger | Best | High-quality content, archives |
null |
- | Original | Original | No optimization |
CRF = Constant Rate Factor (lower = better quality, larger file)
Supported Formats
- webm - Modern, efficient format with excellent compression
- mp4 - Universal compatibility using H.264 codec
- null - Keep original format
How It Works
- User uploads a video through your Filament form
- Component detects video MIME type
- If optimization/conversion is enabled:
- Creates temporary file
- Processes with FFmpeg
- Saves optimized version
- Cleans up temporary files
- If processing fails, original file is uploaded (graceful fallback)
Advanced Example
Performance Considerations
- Processing Time: Video optimization is CPU-intensive and takes time
-
For Large Files: Consider implementing queue jobs:
- Disk Space: Ensure sufficient temporary storage for processing
- Memory Limits: Large videos may require increased PHP memory limits
Troubleshooting
FFmpeg not found
Error: Binary not found
Solution: Install FFmpeg and ensure it's in your system PATH
Videos not being optimized
- Check Laravel logs:
storage/logs/laravel.log - Verify MIME type is detected as video
- Confirm optimization level is set (not
null) - Ensure
localdisk exists inconfig/filesystems.php
Upload fails silently
The package falls back to original file upload if optimization fails. Check logs for error details.
Memory limit errors
For large videos, increase PHP memory:
Testing
Changelog
Please see CHANGELOG for more information on recent changes.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Security
If you discover any security issues, please email [email protected] instead of using the issue tracker.
Credits
- Tony Mansour
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of video-optimizer with dependencies
filament/forms Version ^3.0|^4.0
illuminate/contracts Version ^10.0|^11.0|^12.0
php-ffmpeg/php-ffmpeg Version ^1.2
spatie/laravel-package-tools Version ^1.19.0
pbmedia/laravel-ffmpeg Version ^8.0