搜尋套件、儲存庫與 APP 分類

套件詳情v1.0.0

video_compress_plus

Flutter 的輕量級影片處理函式庫。從 Dart 程式碼中壓縮影片、移除音訊並取得影片縮圖。

AndroidiOSmacOS
近 30 天下載
39
喜歡數
23
Pub 分數
140

安裝套件

flutter pub add video_compress_plus

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

一個輕量級的 Flutter 套件,用於影片處理,讓開發者能直接從 Dart 程式碼中壓縮影片、移除音訊軌道並產生縮圖。專為 Android、iOS 和 macOS 設計,簡化了 Flutter 應用中的多媒體處理。此套件與原生影片處理功能無縫整合,提供高效能的裝置端影片優化。適合需要離線影片編輯或減少檔案大小且不需外部相依性的應用。

適用情境

  • 壓縮影片以加快上傳速度
  • 從影片檔案中移除音訊
  • 為影片預覽產生縮圖
  • 優化應用中的影片儲存
  • 分享前處理影片
  • 減少應用程式封裝大小

主要特色

  • 影片壓縮
  • 音頻移除
  • 縮圖產生
  • 跨平台支援
  • 原生整合
  • 最小設定

適合對象

  • 媒體密集型應用
  • 社群媒體應用
  • 影片編輯工具
  • 檔案管理應用
  • 離線視頻處理器
  • 針對行動裝置和桌面的應用程式

使用建議

  • 需要 Android 和 iOS 的原生權限
  • 僅限基本影片操作
  • 可能因平台特定行為而異
  • 沒有高級影片編輯功能
  • 依賴於底層原生庫
  • 不適用於即時影片處理

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

video_compress

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).

Table of Contents

Lets Get Started

1. Depend on it

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

dependencies:
  video_compress: 1.0.0
    git: https://github.com/kamaravichow/VideoCompressPlus.git
2. Install it

You can install packages from the command line:

with pub:

$  pub get
3. Import it

Now in your Dart code, you can use:

import 'package:video_compress_plus/video_compress_plus.dart';

How to use

Imports
import 'package:video_compress_plus/video_compress_plus.dart';
    

Video compression

MediaInfo mediaInfo = await VideoCompress.compressVideo(
  path,
  quality: VideoQuality.DefaultQuality, 
  deleteOrigin: false, // It's false by default
);

Check compress state

VideoQuality.isCompressing

Get memory thumbnail from VideoPath

final uint8list = await VideoCompress.getByteThumbnail(
  videopath,
  quality: 50, // default(100)
  position: -1 // default(-1)
);

Get File thumbnail from VideoPath

final thumbnailFile = await VideoCompress.getFileThumbnail(
  videopath,
  quality: 50, // default(100)
  position: -1 // default(-1)
);

Get media information

final info = await VideoCompress.getMediaInfo(videopath);

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 VideoCompress.deleteAllCache()

Listen the compression progress

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();
  }
}
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

所屬分類

原始碼儲存庫

使用此套件的專案

暫無相關資料。