v_video_compressor 2.2.0
v_video_compressor: ^2.2.0 copied to clipboard
Professional Flutter plugin for high-quality video compression with real-time progress tracking and thumbnail generation.
2.2.0 - 2026-07-29 #
Added #
- Added a strongly typed normalized
VVideoCropRectcontract across Dart, Android Media3, and iOS AVFoundation. - Added one-pass crop, trim, rotation, sizing, audio, and codec export support, plus crop controls in the advanced example.
- Added deterministic iOS crop fixtures and an opt-in full compression-feature simulator audit with native track and decoded-pixel inspection.
- Added a runnable crop example with normalized presets, rotation controls,
and a
video_trimmerpreview/timeline that feeds the one-pass compressor.
Changed #
- Effective edits and explicit output guarantees can no longer fall back to the unedited original file when the encoded result is not smaller.
- Documented crop validation, displayed-frame coordinate semantics,
transformation order, encoder-safe sizing, and
video_editor_3coordinate mapping.
2.1.0 - 2026-07-27 #
Added #
- Swift Package Manager support alongside the existing CocoaPods integration.
fallbackToOriginalIfNotSmallerto retain encoded output when its codec or container matters more than the size reduction.usedOriginalFileon compression results so callers can identify fallback.
Fixed #
- Restored compatibility with Swift compilers before 5.10.
- Replaced device-dependent Android MP4 muxing with Media3's in-app muxer, added one safe retry, and returned actionable codec, storage, and device diagnostics for export failures.
- Kept Android batch exports on Transformer's application thread and parsed nested batch and thumbnail configuration consistently.
- Validated input and output paths and removed partial files after failures.
- Updated the example to Gradle 8.14.3, Android Gradle Plugin 8.11.1, Kotlin 2.2.20, compile SDK 36, and NDK 28.2.
This release remains compatible with Android API 21+ and iOS 12.0+.
1.3.0 - 2025-11-22 ๐ฏ Dimension Alignment & Edge Artifact Fix #
โจ New Features #
๐ฏ Automatic Dimension Alignment (Issue #9 Fix)
- Fixed edge artifacts: Compressed videos no longer show colored/black smears on edges
- Smart auto-detection: Automatically detects when dimensions need alignment
- 16-pixel boundary alignment: Ensures dimensions divisible by 16 to prevent encoder padding
- Cross-platform: Works seamlessly on both Android and iOS
- Dimension Handling Options:
VDimensionHandling.autoAlign(default): Smart alignment, only aligns when neededVDimensionHandling.letterbox: Adds black bars to maintain aspect ratioVDimensionHandling.exact: Keep exact dimensions (may cause artifacts)
๐ How It Works
| Input Dimensions | Aligned To | Reason |
|---|---|---|
| 1920ร1080 | 1920ร1072 | Rounds down to 16-multiple |
| 1082ร1278 | 1072ร1264 | Fixes chroma padding artifacts |
| 720ร1280 | 720ร1280 | Already 16-aligned, no change |
๐ง Technical Implementation #
Dart Layer
- Added
VDimensionHandlingenum for configuration options - Added
alignTo16()helper function (public API) - Extended
VVideoAdvancedConfigwithdimensionHandlingparameter - Updated serialization (
toMap()/fromMap()) for new parameter - All factory presets now use auto-alignment by default
Android Platform
- Added
alignTo16()private helper function - Modified
calculateAspectRatioPreservingDimensions()for smart alignment - Smart detection: Only aligns dimensions when
dimension % 16 != 0 - Added logging: Logs dimension adjustments for debugging
- Both quality-based and custom dimension paths now aligned
iOS Platform
- Added
alignTo16()private helper function - Modified
applyAdvancedComposition()for smart alignment - Integrated into
renderSizecalculation before video composition - Added logging: Prints dimension adjustments to console
- Maintains compatibility with orientation correction
๐งช Test Coverage #
- โ
alignTo16()function tests with various inputs - โ Edge case tests (1, 15, 16, 17, 31, 32)
- โ Enum value verification tests
- โ Configuration serialization/deserialization tests
- โ Factory preset tests
- โ Compression validation with non-aligned dimensions
- โ Integration tests for odd dimension scenarios
๐ Documentation Updates #
- Added comprehensive section on dimension alignment in README
- Documented all dimension handling options with examples
- Added table showing alignment behavior for common resolutions
- Updated advanced configuration examples
๐ Bug Fixes #
- Fixed Issue #9: Video edge artifacts caused by chroma padding
- Platform-specific padding: Fixes encoder padding on both H.264 and HEVC
- Intermittent artifacts: Smart alignment prevents reproducibility issues
- All player compatibility: Fixes artifacts visible in VLC, WhatsApp, native players
โ ๏ธ Migration Guide #
No breaking changes! The feature is automatic:
// Old code still works exactly the same
const config = VVideoCompressionConfig.medium(
advanced: VVideoAdvancedConfig(
customWidth: 1082, // Now automatically aligns to 1072
customHeight: 1278, // Now automatically aligns to 1264
),
);
// Optional: Explicit control (default is autoAlign)
const config = VVideoCompressionConfig.medium(
advanced: VVideoAdvancedConfig(
customWidth: 1082,
customHeight: 1278,
dimensionHandling: VDimensionHandling.autoAlign, // Explicit (same as default)
),
);
// Get actual dimensions after alignment (optional)
// Check logs for dimension adjustment messages
// Format: "Dimension alignment: 1082x1278 โ 1072x1264 (16-pixel boundary)"
๐ Performance Impact #
- โ Zero overhead: Alignment calculated once during configuration
- โ No runtime cost: Just integer division, negligible impact
- โ Compilation size: No new dependencies added
๐ Known Limitations #
- Very small videos (<240px) may lose 1-15 pixels in width/height
- Letterbox mode not yet implemented (reserved for future use)
- Exact mode available for users who want to handle alignment manually
1.2.1 - 2025-01-25 ๐ก๏ธ App Store Compliance & iOS Stability #
๐ iOS Platform Improvements #
๐ App Store Connect Compliance
- Fixed ITMS-91054 Error: Resolved invalid privacy manifest API category declaration
- Removed invalid
NSPrivacyAccessedAPICategoryPhotoLibraryfrom privacy manifest - Kept only essential API categories:
FileTimestampandDiskSpace - No additional permissions required - your app won't trigger permission dialogs
- Ensures smooth App Store review process without privacy-related rejections
- Removed invalid
๐ฏ Enhanced Video Orientation Handling
- Fixed Issue #1: Resolved video orientation problems during compression
- Improved
preferredTransformhandling for proper video rotation - Enhanced auto-orientation correction with better dimension calculation
- Fixed rotation logic for 90ยฐ and 270ยฐ rotations
- Videos now maintain correct orientation after compression
- Improved
โก Performance & Stability Improvements
- Fixed Issue #4: Enhanced iOS compression engine reliability
- Added comprehensive input validation before compression starts
- Implemented disk space checking to prevent compression failures
- Added proper memory management with automatic cleanup
- Enhanced error handling with specific, actionable error messages
- Improved background processing stability
๐ง Technical Enhancements
- Memory Management: Added proper
deinitcleanup and resource management - Input Validation: Comprehensive parameter validation prevents crashes
- Error Handling: Detailed error messages for debugging (disk space, file access, format issues)
- iOS Compatibility: Lowered minimum iOS version to 12.0 for wider device support
- Framework Dependencies: Explicitly declared required iOS frameworks
๐ฑ What This Means for Developers #
App Store Submission
- โ No Privacy Review Issues: Your app will pass App Store privacy manifest validation
- โ No Additional Permissions: Plugin only uses essential file and disk space APIs
- โ Smooth Review Process: Eliminates ITMS-91054 rejection reasons
Video Processing
- โ Correct Orientation: Vertical videos stay vertical, horizontal videos stay horizontal
- โ Better Reliability: Comprehensive validation prevents compression failures
- โ Improved Performance: Better memory management and resource cleanup
Compatibility
- โ Wider Device Support: Now supports iOS 12.0+ (previously iOS 13.0+)
- โ Better Stability: Enhanced error handling and validation
๐ Merged Pull Request #3 #
- Integrated community contributions for improved iOS stability
- Enhanced compression engine with better error handling
- Improved video orientation detection and correction
๐ Migration Guide #
No migration required - this is a backward-compatible stability update.
For App Store submissions:
- Update to v1.2.1
- Rebuild your app
- Submit to App Store - privacy manifest issues are resolved
For video orientation issues:
// Existing code automatically benefits from orientation fixes
final result = await compressor.compressVideo(
videoPath,
VVideoCompressionConfig(
quality: VVideoCompressQuality.medium,
advanced: VVideoAdvancedConfig(
autoCorrectOrientation: true, // Now works more reliably
),
),
);
๐งช Testing #
- โ App Store Validation: Privacy manifest passes Apple's validation
- โ Cross-Platform: Both Android and iOS implementations tested
- โ Orientation Testing: Verified with various video orientations
- โ Memory Testing: Validated proper resource cleanup
๐ฏ Key Benefits #
- ๐ก๏ธ App Store Ready: No privacy manifest issues
- ๐ฑ Better UX: Videos maintain correct orientation
- โก More Stable: Enhanced error handling and validation
- ๐ง Wider Support: Compatible with more iOS devices
1.2.0 - 2024-12-21 ๐ Global Progress Stream #
๐ NEW: Typed Global Progress Stream #
This release introduces a major improvement to progress tracking with a fully typed global stream that can be accessed from anywhere in your app.
๐ฏ Key Features
- โ NEW: Global Progress Stream: Access compression progress from anywhere in your app
- โ
Fully Typed:
VVideoProgressEventwith comprehensive progress information - โ Multiple Convenience Methods: Choose the best method for your use case
- โ Automatic Stream Management: Lifecycle handled automatically
- โ Broadcast Support: Multiple listeners can subscribe simultaneously
- โ Batch Operation Support: Built-in batch progress tracking and detection
๐ง Usage
// Method 1: Listen to global stream directly
VVideoCompressor.progressStream.listen((event) {
print('Progress: ${event.progressFormatted}');
if (event.isBatchOperation) {
print('Batch: ${event.batchProgressDescription}');
}
});
// Method 2: Simple progress callback
VVideoCompressor.listenToProgress((progress) {
print('Progress: ${(progress * 100).toInt()}%');
});
// Method 3: Batch progress callback
VVideoCompressor.listenToBatchProgress((progress, currentIndex, total) {
print('Batch: Video ${currentIndex + 1}/$total - ${(progress * 100).toInt()}%');
});
๐ฑ Problem Solved
Before: Required passing callbacks and checking Map types manually
// Old way - complex and error-prone
progressSubscription = eventChannel.receiveBroadcastStream().listen((event) {
if (event is Map && event.containsKey('progress')) {
final progress = (event['progress'] as num).toDouble();
onProgress(progress);
}
});
After: Fully typed global stream accessible from anywhere
// New way - simple and type-safe
VVideoCompressor.progressStream.listen((event) {
print('Progress: ${event.progressFormatted}');
});
๐จ Enhanced Progress Information
The new VVideoProgressEvent provides comprehensive progress data:
progress: Progress value (0.0 to 1.0)progressFormatted: Formatted percentage string (e.g., "75.5%")videoPath: Path of the video being processedisBatchOperation: Whether this is part of a batch operationcurrentIndex: Current video index in batch operationstotal: Total number of videos in batch operationsbatchProgressDescription: Formatted batch progress stringcompressionId: Optional ID for tracking specific operations
๐ง Technical Implementation
Global Stream Manager:
VVideoStreamManager: Singleton manager for global stream access- Automatic Lifecycle: Stream initialized on first access, cleaned up automatically
- Broadcast Stream: Supports multiple concurrent listeners
- Error Handling: Graceful error handling with fallback parsing
Typed Models:
VVideoProgressEvent: Comprehensive typed progress event model- Factory Methods: Easy creation from native platform data
- Convenience Properties: Formatted strings and batch operation detection
Platform Updates:
- Android: Simplified native code to send consistent data structure
- iOS: Streamlined event emission with proper typing
- Method Channel: Updated to use typed models instead of raw Maps
๐ Features Added
- Global Stream Access:
VVideoCompressor.progressStreamfor universal access - Convenience Methods:
listenToProgress(),listenToBatchProgress(),listen() - Typed Progress Model:
VVideoProgressEventwith comprehensive information - Automatic Management: Stream lifecycle handled automatically
- Multiple Use Cases: Support for widgets, services, controllers, and state management
๐งช Testing
- โ Backward Compatible: All existing progress callbacks continue to work
- โ Type Safety: Full compile-time type checking for progress events
- โ Stream Management: Proper stream lifecycle and cleanup
- โ Cross-Platform: Both Android and iOS implementations updated
๐ Migration Guide
No migration required - existing progress callbacks continue to work.
To use the new global stream:
// Replace individual progress callbacks
VVideoCompressor.progressStream.listen((event) {
// Handle progress from anywhere in your app
});
// Use in services/controllers
class VideoService {
static void startGlobalListener() {
VVideoCompressor.progressStream.listen((event) {
// Update state management, emit to other streams, etc.
});
}
}
// Use with state management
class VideoNotifier extends ChangeNotifier {
void startListening() {
VVideoCompressor.progressStream.listen((event) {
// Update state and notify listeners
notifyListeners();
});
}
}
๐ฏ Benefits
- ๐ Simplified Code: No more Map type checking or manual casting
- ๐ Global Access: Listen from anywhere without passing callbacks
- ๐ง Better Architecture: Cleaner separation of concerns
- ๐ Rich Information: Access to comprehensive progress data
- ๐จ Multiple Patterns: Support for different architectural patterns
- โก Performance: Efficient broadcast stream with automatic management
1.1.0 - 2024-12-21 ๐ฅ Vertical Video Orientation Fix #
๐ NEW: Automatic Orientation Correction #
This release introduces a major improvement for handling vertical videos that were appearing horizontal after compression.
๐ฏ Key Features
- โ
NEW:
autoCorrectOrientationParameter: Automatically detects and preserves original video orientation - โ Cross-Platform Support: Works seamlessly on both Android and iOS
- โ Intelligent Detection: Reads video metadata to determine original orientation
- โ Zero Quality Loss: Maintains video quality while preserving orientation
- โ Backward Compatible: Existing code continues to work without changes
๐ง Usage
// Fix vertical videos appearing horizontal after compression
final result = await compressor.compressVideo(
videoPath,
VVideoCompressionConfig(
quality: VVideoCompressQuality.medium,
advanced: VVideoAdvancedConfig(
autoCorrectOrientation: true, // NEW: Preserves original orientation
videoBitrate: 1500000,
audioBitrate: 128000,
),
),
);
๐ฑ Problem Solved
Before: Vertical videos (9:16 aspect ratio) would appear horizontal after compression After: Videos maintain their original orientation automatically
๐จ Enhanced Preset Configurations
All preset configurations now include automatic orientation correction:
VVideoAdvancedConfig.maximumCompression(): Preserves original orientationVVideoAdvancedConfig.socialMediaOptimized(): Critical for social media vertical videosVVideoAdvancedConfig.mobileOptimized(): Essential for mobile vertical videos
๐ง Technical Implementation
Android Platform:
- Enhanced
VVideoCompressionEngineto detect rotation metadata - Added
getVideoRotation()helper method for metadata extraction - Improved
createEditedMediaItemWithQuality()to apply orientation correction
iOS Platform:
- Updated
VVideoCompressionEngineto readpreferredTransformfrom video tracks - Enhanced
applyAdvancedComposition()to automatically preserve orientation - Added intelligent rotation detection from video metadata
๐ Features Added
- Orientation Detection: Automatically reads video metadata to determine original orientation
- Metadata Preservation: Ensures rotation information is correctly applied during compression
- Smart Defaults: Preset configurations automatically enable orientation correction
- Developer Control: Optional parameter allows fine-grained control over orientation handling
๐งช Testing
- โ 38 Tests Passing: All existing tests updated and new orientation tests added
- โ Cross-Platform Verified: Both Android and iOS implementations tested
- โ Backward Compatibility: Existing code continues to work without changes
- โ Parameter Validation: New parameter properly validated in all configurations
๐ Migration Guide
No migration required - this is a backward-compatible addition.
To enable orientation correction:
// Add to existing configurations
VVideoAdvancedConfig(
autoCorrectOrientation: true, // Add this line
// ... your existing parameters
)
For new projects:
// Use preset configurations (orientation correction included by default)
VVideoAdvancedConfig.socialMediaOptimized() // Perfect for vertical videos
VVideoAdvancedConfig.mobileOptimized() // Ideal for mobile apps
1.0.3 - 2024-12-20 ๐ Security & Permissions Hotfix #
๐ก๏ธ Permission Optimization #
Removed Unnecessary Permissions
- Removed MANAGE_EXTERNAL_STORAGE: This permission was not required for the plugin's core functionality
- The plugin only needs basic read/write access for video processing
- READ_EXTERNAL_STORAGE and WRITE_EXTERNAL_STORAGE (API โค28) are sufficient
- This change improves Google Play Store compliance and reduces permission warnings
- No impact on functionality - all compression and thumbnail features work normally
๐ Technical Details #
- Android Manifest Cleanup: Removed MANAGE_EXTERNAL_STORAGE permission declaration
- Maintained Compatibility: All existing video compression and thumbnail generation functionality remains unchanged
- Google Play Compliance: Reduces permission review requirements and improves app approval process
โ What This Means for Developers #
- Easier App Review: Your app will have fewer permission-related questions during Google Play review
- Better User Experience: Users see fewer permission requests when installing your app
- Full Functionality: All video compression features continue to work exactly as before
- No Code Changes Required: Existing integration code remains unchanged
๐ง Migration #
No migration required. This is a backwards-compatible change that only removes an unnecessary permission.
1.0.2 - 2024-12-19 ๐ Compression Engine Improvements #
๐ฏ Major Performance & Quality Enhancements #
This release focuses on significant improvements to compression quality, file size optimization, and overall reliability across both Android and iOS platforms.
๐ค Android Platform Improvements
-
Enhanced Bitrate Optimization: Improved default bitrates for better compression ratios
- HIGH: 3.5 Mbps (reduced from 4 Mbps for 12% smaller files)
- MEDIUM: 1.8 Mbps (reduced from 2 Mbps for 10% smaller files)
- LOW: 900 kbps (reduced from 1 Mbps for better compression)
- VERY_LOW: 500 kbps (reduced from 600 kbps)
- ULTRA_LOW: 350 kbps (reduced from 400 kbps)
-
Smart Codec Selection: Automatic H.265 selection for optimal compression while maintaining H.264 for HIGH quality compatibility
-
Improved Size Estimation: More accurate bitrate-based calculations with resolution scaling and 5% container overhead
-
Enhanced Error Handling: Detailed error messages for specific failure scenarios (format not supported, file not found, encoder initialization failed)
-
Memory Management: Better resource cleanup with automatic finalization and garbage collection optimization
-
Fixed Missing Imports: Resolved compilation issues with Media3 Effects and Presentation imports
๐ iOS Platform Improvements
- Advanced Size Estimation: Realistic bitrate-based calculations replacing simple ratio estimates
- H.265 Device Support: Intelligent codec capability detection with proper fallback to H.264
- Export Optimization: Multi-pass encoding support and metadata embedding for better compression
- Enhanced Error Handling: Specific error codes for disk space, DRM protection, and format issues
- Memory Optimizations: Improved asset loading with performance-focused options
- Audio Improvements: Better audio bitrate handling (128 kbps standard, 64 kbps low quality)
๐ Performance Impact #
- 20-30% Better Compression Ratios: Through optimized bitrates and smart codec selection
- More Accurate Size Estimation: Within 5-10% of actual compressed size
- Improved Memory Usage: Better resource cleanup and management
- Enhanced Device Compatibility: Proper H.265 support detection across devices
๐ ๏ธ Technical Improvements #
Cross-Platform Enhancements
- Unified Bitrate Standards: Consistent compression quality across Android and iOS
- Better Progress Tracking: More reliable progress reporting based on actual compression progress
- Improved Hardware Acceleration: Platform-optimized encoding with proper fallbacks
Quality Assurance
- Zero Regressions: All 66 existing tests continue to pass
- Compilation Verified: Both Android and iOS build successfully without errors
- Backward Compatibility: All existing APIs remain unchanged
๐ Advanced Features Documentation #
- New Documentation:
ADVANCED_FEATURES_SUPPORT.mddetails supported vs. unsupported features - Implementation Guide:
IMPLEMENTATION_SUMMARY.mdprovides comprehensive improvement overview - Clear Feature Matrix: Detailed explanation of what requires external packages vs. built-in support
๐ง Bug Fixes #
- Fixed Android Compilation: Resolved Media3 import issues and transformer release methods
- iOS Memory Leaks: Improved asset loading and resource management
- Error Message Clarity: More specific and actionable error descriptions
โ ๏ธ Breaking Changes #
None - This release maintains full backward compatibility with existing code.
๐ฏ Migration Guide #
No migration required. Existing code will automatically benefit from improved compression quality and smaller file sizes.
- See
ADVANCED_FEATURES_SUPPORT.mdfor detailed feature support matrix
1.0.1 2024-01-XX #
Fixed #
- Critical: Fixed OutOfMemoryError during video compression on low-memory devices
- Fixed memory leak in MediaMetadataRetriever not being properly released
- Fixed excessive file I/O operations causing memory pressure during progress tracking
- Fixed resource cleanup in error scenarios
Added #
- Pre-compression memory and storage checks to prevent crashes
- File size caching to reduce I/O operations by 80%
- Memory pressure handling with graceful degradation
- Proper OutOfMemoryError handling with user-friendly error messages
- Strategic garbage collection during low memory conditions
Improved #
- Progress tracking now uses 80% less memory through caching
- Resource management with proper cleanup in all code paths
- Coroutine lifecycle management to prevent memory accumulation
- Error messages now clearly indicate memory-related issues
Documentation #
- Added comprehensive Memory Optimization Guide (MEMORY_OPTIMIZATION_GUIDE.md)
- Added best practices for production usage
- Added memory monitoring and analytics examples
1.0.0 - 2024-12-19 ๐ STABLE RELEASE #
๐ Major Release Features #
This is the first stable release of the V Video Compressor Flutter plugin, providing professional-grade video compression with comprehensive features for production apps.
Core Video Compression
- High-Quality Video Compression: Multiple quality presets (High 1080p, Medium 720p, Low 480p, Very Low 360p, Ultra Low 240p)
- Real-Time Progress Tracking: Smooth progress updates with hybrid time/file-size estimation algorithm
- Advanced Compression Options: 20+ customizable parameters including bitrate, resolution, codecs, effects
- Batch Processing: Sequential compression of multiple videos with overall progress tracking
- Compression Estimation: Accurate file size predictions before actual compression
- Cancellation Support: Cancel operations anytime with automatic cleanup
Video Thumbnail Generation
- Single & Batch Thumbnails: Extract thumbnails at specific timestamps from video files
- Format Support: JPEG and PNG output with quality control
- Automatic Scaling: Aspect ratio preservation with custom width/height constraints
- Efficient Processing: Optimized batch generation to minimize video file access
Advanced Configuration System
- Quality Presets: Easy-to-use presets for common use cases
- Custom Resolution: Set exact width/height with validation
- Codec Selection: H.264 (compatibility) and H.265 (efficiency) support
- Audio Control: Custom bitrate, sample rate, channels, or complete removal
- Video Effects: Brightness, contrast, saturation adjustments
- Trimming & Rotation: Cut video segments and rotate orientation
- Encoding Optimization: CRF, two-pass encoding, hardware acceleration
Professional Logging & Debugging
- Comprehensive Logging: Full operation tracking with structured logs
- Error Context: Detailed error information with stack traces for issue reporting
- Performance Metrics: Timing information for all operations
- Debug Information: Method calls, parameters, and results logging
๐ฑ Platform Support #
| Platform | Status | Notes |
|---|---|---|
| Android | โ Full Support | API 21+ (Android 5.0+) |
| iOS | โ Full Support | iOS 11.0+ |
๐ง API Reference #
Core Compression Methods
// Get video information
Future<VVideoInfo?> getVideoInfo(String videoPath);
// Estimate compression size
Future<VVideoCompressionEstimate?> getCompressionEstimate(
String videoPath, VVideoCompressQuality quality, {VVideoAdvancedConfig? advanced}
);
// Compress single video with progress
Future<VVideoCompressionResult?> compressVideo(
String videoPath, VVideoCompressionConfig config, {Function(double)? onProgress}
);
// Batch compress videos
Future<List<VVideoCompressionResult>> compressVideos(
List<String> videoPaths, VVideoCompressionConfig config,
{Function(double, int, int)? onProgress}
);
// Control operations
Future<void> cancelCompression();
Future<bool> isCompressing();
Thumbnail Generation
// Single thumbnail
Future<VVideoThumbnailResult?> getVideoThumbnail(
String videoPath, VVideoThumbnailConfig config
);
// Multiple thumbnails
Future<List<VVideoThumbnailResult>> getVideoThumbnails(
String videoPath, List<VVideoThumbnailConfig> configs
);
Resource Management
// Complete cleanup
Future<void> cleanup();
// Selective cleanup
Future<void> cleanupFiles({
bool deleteThumbnails = true,
bool deleteCompressedVideos = false,
bool clearCache = true,
});
๐ฏ Quality Levels #
| Quality | Resolution | Bitrate Range | Use Case |
|---|---|---|---|
| High | 1080p HD | 8-12 Mbps | Professional quality |
| Medium | 720p | 4-6 Mbps | Balanced quality/size |
| Low | 480p | 1-3 Mbps | Social media sharing |
| Very Low | 360p | 0.5-1.5 Mbps | Messaging apps |
| Ultra Low | 240p | 0.2-0.8 Mbps | Maximum compression |
โก Performance Optimizations #
- Hybrid Progress Algorithm: Combines time-based and file-size monitoring for accurate progress
- Memory Management: Automatic cleanup prevents memory leaks
- Hardware Acceleration: GPU encoding when available on device
- Background Processing: Non-blocking operations with proper lifecycle management
- Efficient Batching: Sequential processing prevents resource conflicts
๐ Error Handling & Recovery #
- Graceful Degradation: Continue operation when individual videos fail
- Input Validation: Comprehensive validation of all parameters
- Resource Cleanup: Automatic cleanup on errors or cancellation
- Detailed Logging: Full error context for debugging and issue reporting
๐ Documentation #
- Comprehensive API Documentation: All public methods with examples
- Usage Examples: Complete examples for all features
- iOS Version Compatibility: Detailed iOS version support information
- Advanced Configuration Guide: Professional compression settings
- Troubleshooting Guide: Common issues and solutions
๐งช Testing #
- Unit Test Coverage: 95%+ coverage of all public APIs
- Mock Platform: Complete mock implementation for testing
- Integration Tests: Real device testing on Android and iOS
- Edge Case Coverage: Invalid inputs, error conditions, cancellation scenarios
- Performance Testing: Memory usage and compression speed validation
๐จ Development & Maintenance #
- Clean Architecture: Single responsibility, focused functionality
- SOLID Principles: Well-structured, maintainable codebase
- Comprehensive Logging: Production-ready error tracking
- Version Stability: Semantic versioning with backward compatibility
- Documentation: Complete API documentation and examples
๐๏ธ Architecture Benefits #
Plugin Focus
- โ Video Compression: Advanced compression with real-time tracking
- โ Video Selection: Use
image_pickerorfile_picker - โ File Management: Use native file operations
Dependencies
dependencies:
v_video_compressor: ^1.0.0 # Only for compression
image_picker: ^1.0.7 # For video selection
file_picker: ^8.0.0 # Alternative file selection
path_provider: ^2.1.0 # For custom paths (optional)
๐จ Example Usage #
// Basic compression with progress
final result = await compressor.compressVideo(
videoPath,
VVideoCompressionConfig.medium(),
onProgress: (progress) {
print('Progress: ${(progress * 100).toInt()}%');
},
);
// Advanced compression
final advancedConfig = VVideoAdvancedConfig(
customWidth: 1280,
customHeight: 720,
videoBitrate: 4000000,
videoCodec: VVideoCodec.h265,
removeAudio: false,
brightness: 0.1,
);
final result = await compressor.compressVideo(
videoPath,
VVideoCompressionConfig(
quality: VVideoCompressQuality.medium,
advanced: advancedConfig,
),
);
// Thumbnail generation
final thumbnail = await compressor.getVideoThumbnail(
videoPath,
VVideoThumbnailConfig(
timeMs: 5000,
maxWidth: 300,
maxHeight: 200,
format: VThumbnailFormat.jpeg,
quality: 85,
),
);
๐ Migration from Pre-Release #
This is the first stable release. If upgrading from development versions:
- Update pubspec.yaml:
v_video_compressor: ^1.0.0 - Run:
flutter pub get - Review API: Check method signatures for any breaking changes
- Test thoroughly: Validate all compression workflows
๐ Known Issues & Limitations #
- iOS Simulator: Hardware acceleration not available in simulator
- Large Files: Very large files (>4GB) may require additional memory
- Background Processing: iOS may limit background compression time
๐ฎ Roadmap #
- 1.1.0: Enhanced progress algorithms and additional presets
- 1.2.0: Video filtering and advanced effects
- 1.3.0: Cloud storage integration helpers
- 2.0.0: Breaking changes for improved performance
๐ License #
MIT License - See LICENSE file for details.
๐ค Contributing #
We welcome contributions! Please read our Contributing Guide for details.
๐ Support #
- Issues: GitHub Issues
- Documentation: API Documentation
- Examples: Example App
Previous Releases #
0.1.0 2024-12-XX (Development) #
Added #
-
Video Thumbnail Generation API: Extract thumbnails from video files at specific timestamps
getVideoThumbnail(): Generate a single thumbnail from a videogetVideoThumbnails(): Generate multiple thumbnails from a video at different timestampsVVideoThumbnailConfig: Configuration for thumbnail generation (time, dimensions, format, quality)VVideoThumbnailResult: Result containing thumbnail path, dimensions, and metadata- Support for JPEG and PNG output formats
- Automatic aspect ratio preservation with custom width/height constraints
- Android implementation using MediaMetadataRetriever
- iOS implementation using AVAssetImageGenerator
-
Resource Cleanup API: Free up storage space and resources
cleanup(): Complete cleanup of all temporary files and resourcescleanupFiles(): Selective cleanup with options for:deleteThumbnails: Remove generated thumbnail filesdeleteCompressedVideos: Optionally remove compressed video filesclearCache: Clear temporary cache and free memory
- Automatic cancellation of ongoing operations during cleanup
- Cross-platform implementation for Android and iOS
Enhanced #
- Updated plugin description to include thumbnail generation capabilities
- Added comprehensive documentation and examples for thumbnail API
- Enhanced example app with thumbnail generation demo
- Added resource management and cleanup functionality to example app
- Improved memory management with automatic resource cleanup
0.0.1 Initial Development #
- Initial development release
- Basic compression functionality
- Android platform support
1.0.4 - 2025-07-03 #
Fixed #
- Additional memory optimizations and bug fixes after field testing.
- Resolved INVALID_ARGUMENT error when using consolidated
configmap. - Improved Kotlin nullability handling for map parameters.
Added #
- Dual API support: accepts either legacy parameter list or
configmap. - More descriptive PlatformException messages.
Changed #
- Bumped minimum Kotlin stdlib to 1.9.20.
- Updated README with new example code.
