video_compress_v2

Creator: coderz1093

Last updated:

Add to Cart

Description:

video compress v2

video_compress_v2 #


A new Flutter video compress support convert HDR video to SDR video.
Compress videos, remove audio, manipulate thumbnails, and make your video compatible with all platforms through this lightweight and efficient library.
100% native code was used, we do not use FFMPEG as it is very slow, bloated and the GNU license is an obstacle for commercial applications.
Table of Contents #

Installing
How to use

Imports
Video compression
Check compress state
Get memory thumbnail from VideoPath
Get File thumbnail from VideoPath
Get media information
delete all cache files
Listen the compression progress


TODO

Lets Get Started #
1. Depend on it #
Add this to your package's pubspec.yaml file:
dependencies:
video_compress_v2: last-version
copied to clipboard
2. Install it #
You can install packages from the command line:
with pub:
$ pub get
copied to clipboard
3. Import it #
Now in your Dart code, you can use:
import 'package:video_compress_v2/video_compress.dart';
copied to clipboard
How to use #
Imports #
import 'package:video_compress_v2/video_compress.dart';

copied to clipboard
Video compression #
MediaInfo mediaInfo = await VideoCompressV2.compressVideo(
path,
quality: VideoQuality.DefaultQuality,
deleteOrigin: false, // It's false by default
);
copied to clipboard
Check compress state #
VideoQuality.isCompressing
copied to clipboard

Get memory thumbnail from VideoPath #
final uint8list = await VideoCompressV2.getByteThumbnail(
videopath,
quality: 50, // default(100)
position: -1 // default(-1)
);
copied to clipboard
Get File thumbnail from VideoPath #
final thumbnailFile = await VideoCompressV2.getFileThumbnail(
videopath,
quality: 50, // default(100)
position: -1 // default(-1)
);
copied to clipboard
Get media information #
final info = await VideoCompressV2.getMediaInfo(videopath);

copied to clipboard
delete all cache files #

Delete all files generated by this will delete all files located at 'video_compress', you shoule ought to know what are you doing.

await VideoCompressV2.deleteAllCache()
copied to clipboard
Listen the compression progress #
class _Compress extends State<Compress> {

Subscription _subscription;

@override
void initState() {
super.initState();
_subscription =
VideoCompressV2.compressProgress$.subscribe((progress) {
debugPrint('progress: $progress');
});
}

@override
void dispose() {
super.dispose();
_subscription.unsubscribe();
}
}
copied to clipboard
TODO #

Add the trim video function
Add cancel function to Android

Methods #



Functions
Parameters
Description
Returns




getByteThumbnail
String path[video path], int quality(1-100)[thumbnail quality], int position[Get a thumbnail from video position]
get thumbnail from video path
Future<Uint8List>


getFileThumbnail
String path[video path], int quality(1-100)[thumbnail quality], int position[Get a thumbnail from video position]
get thumbnail file from video path
Future<File>


getMediaInfo
String path[video path]
get media information from video path
Future<MediaInfo>


compressVideo
String path[video path], VideoQuality quality[compressed video quality], bool deleteOrigin[delete the origin video], int startTime[compression video start time], int duration[compression video duration from start time], bool includeAudio[is include audio in compressed video], int frameRate[compressed video frame rate]
compression video at origin video path
Future<MediaInfo>


cancelCompression
none
cancel compressing
Future<void>


deleteAllCache
none
Delete all files generated by 'video_compress' will delete all files located at 'video_compress'
Future<bool>



Subscriptions #



Subscriptions
Description
Stream




compressProgress$
Subscribe the compression progress steam
double progress



Contribute #
Contributions are always welcome!
acknowledgment #
Inspired by the flutter_ffmpeg library.
https://github.com/rurico/flutter_video_compress
https://github.com/jonataslaw/VideoCompress.git
Made with ❤ by Flutter team at Tastech-asia

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.