A macOS application built with Flutter that allows users to compress video files using FFmpeg.
- Video file selection using system file picker (via image_picker)
- Video file compression using FFmpeg
- Progress tracking during compression with real-time updates
- Configurable compression parameters:
- CRF (Constant Rate Factor) - 0-51, where lower values mean higher quality
- Preset - Controls encoding speed to compression ratio
- Video bitrate - Target bitrate for video encoding
- Audio bitrate - Target bitrate for audio encoding
- File size comparison between input and output files
- Flutter SDK
- macOS development environment
- Clone or download this repository
- Run
flutter pub getto install dependencies - Run
flutter run -d macosto launch the application
- Click "Select Video" to choose a video file for compression using the system file picker
- Adjust compression parameters as needed:
- CRF: 0 (lossless) to 51 (worst quality), default is 23
- Preset: ultrafast, superfast, veryfast, faster, fast, medium, slow, slower, veryslow
- Video Bitrate: e.g., 1000k, 2M (optional)
- Audio Bitrate: e.g., 128k, 256k
- Click "Compress Video" to start the compression process
- Progress will be displayed during compression with percentage
- Once complete, the compressed video will be saved in your Downloads directory
The application uses the ffmpeg_kit_flutter_new package to execute FFmpeg commands for video compression. The core command used is:
ffmpeg -i [input] -c:v libx264 -crf [value] -preset [value] -c:a aac -b:a [value] [output]
-
CRF (Constant Rate Factor): Controls quality where:
- 0 = lossless compression
- 18-28 = visually transparent to good quality
- 23 = default value
- 51 = worst quality
-
Preset: Controls the speed of compression:
- ultrafast = fastest, largest file size
- medium = default balance
- veryslow = slowest, smallest file size
-
Video Bitrate: Alternative to CRF for controlling quality:
- 500k = low quality
- 1000k = medium quality
- 2M = high quality
-
Audio Bitrate: Controls audio quality:
- 128k = standard quality
- 256k = high quality
If you encounter any issues:
- Make sure you have proper permissions to read the input file and write to the output directory
- Ensure the input video file is a valid format supported by FFmpeg
- Check that you have enough disk space for the output file
- If the app crashes during compression, try adjusting the compression parameters to be less intensive
The application implements two levels of progress tracking:
- Time-based tracking: When video duration is available, it calculates progress based on processed time vs. total duration
- Frame-based tracking: When duration is not available, it displays the current frame number being processed
The app uses FFprobe (from the ffmpeg_kit_flutter_new package) to accurately determine video duration, with a fallback to FFmpeg if FFprobe fails.
Video compression is performed asynchronously using FFmpegKit.executeAsync to ensure the UI remains responsive and progress updates are smooth.
- Add support for more compression parameters
- Implement compression cancellation functionality
- Add preview functionality for compressed videos
- Allow users to select the output directory
- Add support for batch processing multiple videos