분류, 패키지 및 저장소 검색

패키지 상세v3.1.4

video_compress

Flutter용 가벼운 비디오 조작 라이브러리입니다. Dart 코드에서 비디오 압축, 오디오 제거, 비디오 썸네일 가져오기

AndroidiOSmacOS
30일 다운로드
22.4만
좋아요
748
Pub 점수
140

패키지 설치

flutter pub add video_compress

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

Dart 코드에서 직접 동영상을 압축하고 오디오 트랙을 제거하며 썸네일을 생성할 수 있는 가벼운 Flutter 패키지입니다. Android, iOS, macOS에서 효율적인 멀티미디어 처리를 위해 설계되었으며, 네이티브 플랫폼 코드 없이 일반적인 비디오 처리 작업을 간소화합니다. 디바이스 내 비디오 최적화 및 미리보기 생성이 필요한 앱에 적합합니다.

사용 사례

  • 저장을 위해 큰 비디오 파일 압축
  • 비디오에서 오디오 제거
  • 비디오 파일에서 썸네일 생성
  • 업로드를 위해 비디오 최적화
  • 실시간으로 비디오 처리하기
  • 압축된 미디어로 앱 크기 줄이기

주요 기능

  • 비디오 압축 지원
  • 오디오 제거 기능
  • 미리보기 추출
  • 크로스 플랫폼 호환성
  • 간단한 Dart API
  • 가볍고 빠름

적합한 대상

  • 미디어 집약형 앱
  • 비디오 공유 플랫폼
  • 콘텐츠 생성 도구
  • 동영상 업로드 기능이 있는 모바일 앱
  • 오프라인 비디오 처리가 필요한 앱
  • 최소한의 네이티브 코드를 찾는 개발자

고려 사항

  • 네이티브 플랫폼 권한이 필요합니다
  • 저사양 기기에서 성능에 영향을 미칠 수 있습니다
  • 기본 비디오 작업에 제한됨
  • 기본 네이티브 라이브러리에 의존합니다
  • 복잡한 비디오 편집에 적합하지 않습니다
  • 파일 크기 감소는 원본 품질에 따라 달라집니다

원본 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: ^3.1.0
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/video_compress.dart';

How to use

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

Video compression

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

Check compress state

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

카테고리

소스 저장소

이 패키지를 사용하는 프로젝트