video_compress
Flutter용 가벼운 비디오 조작 라이브러리입니다. Dart 코드에서 비디오 압축, 오디오 제거, 비디오 썸네일 가져오기
이 가볍고 효율적인 라이브러리를 통해 비디오를 압축하고, 오디오를 제거하며, 썸네일을 조작하고, 모든 플랫폼과 호환되는 비디오로 만들 수 있습니다.
{"sdk":"flutter"}아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.
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. In addition, google chrome uses VP8/VP9, safari uses h264, and most of the time, it is necessary to encode the video in two formats, but not with this library. All video files are encoded in an MP4 container with AAC audio that allows 100% compatibility with safari, mozila, chrome, android and iOS.
Works on ANDROID, IOS and desktop (just MacOS for now).
Add this to your package's pubspec.yaml file:
dependencies:
video_compress: ^3.1.0
You can install packages from the command line:
with pub:
$ pub get
Now in your Dart code, you can use:
import 'package:video_compress/video_compress.dart';
import 'package:video_compress/video_compress.dart';
MediaInfo mediaInfo = await VideoCompress.compressVideo(
path,
quality: VideoQuality.DefaultQuality,
deleteOrigin: false, // It's false by default
);
VideoCompress.isCompressing
final uint8list = await VideoCompress.getByteThumbnail(
videopath,
quality: 50, // default(100)
position: -1 // default(-1)
);
final thumbnailFile = await VideoCompress.getFileThumbnail(
videopath,
quality: 50, // default(100)
position: -1 // default(-1)
);
final info = await VideoCompress.getMediaInfo(videopath);
await VideoCompress.deleteAllCache()
class _Compress extends State<Compress> {
Subscription _subscription;
@override
void initState() {
super.initState();
_subscription =
VideoCompress.compressProgress$.subscribe((progress) {
debugPrint('progress: $progress');
});
}
@override
void dispose() {
super.dispose();
_subscription.unsubscribe();
}
}
| 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 | Description | Stream |
|---|---|---|
| compressProgress$ | Subscribe the compression progress steam | double progress |
Contributions are always welcome!
Inspired by the flutter_ffmpeg library. https://github.com/rurico/flutter_video_compress