hw_video_compress 1.0.1 copy "hw_video_compress: ^1.0.1" to clipboard
hw_video_compress: ^1.0.1 copied to clipboard

A Flutter plugin for video compression on Android and iOS using hardware-accelerated APIs.

hw_video_compress #

A powerful and easy-to-use Flutter plugin for compressing videos on Android and iOS using hardware acceleration.

Note

This package uses hardware-accelerated transcoding, which makes it highly efficient and best suited for large video files (100MB+). It typically compresses video size by 80% while maintaining great visual quality.

Features #

  • Hardware Acceleration: Uses native hardware codecs on Android (via Transcoder) and iOS (AVAssetExportSession) for fast video compression.
  • Progress Tracking: Provides a stream to listen to compression progress in real-time (from 0.0 to 1.0).

Installation #

Add this to your package's pubspec.yaml file:

dependencies:
  hw_video_compress: ^1.0.0

Usage #

Import the package #

import 'package:hw_video_compress/hw_video_compress.dart';

Compress a Video #

To compress a video, create an instance of HwVideoCompress and call compressVideo() passing the absolute path of the input file.

final hwVideoCompress = HwVideoCompress();

final String? compressedFilePath = await hwVideoCompress.compressVideo(
  '/path/to/your/input_video.mp4',
);

print('Compressed video saved at: $compressedFilePath');

Listen to Compression Progress #

You can listen to the onProgress stream to get live updates while the video is compressing.

final subscription = hwVideoCompress.onProgress.listen((progress) {
  print('Compression Progress: ${(progress * 100).toStringAsFixed(1)}%');
});

// Don't forget to cancel the subscription when you are done!
// subscription.cancel();

Example #

For a complete working example, please check the example folder in this repository.

1
likes
160
points
--
downloads

Documentation

API reference

Publisher

unverified uploader

A Flutter plugin for video compression on Android and iOS using hardware-accelerated APIs.

Repository (GitHub)
View/report issues

Topics

#video #video-compression #hardware-acceleration #media #transcoding

License

MIT (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on hw_video_compress

Packages that implement hw_video_compress